Best way to 'touch' a file?

Kenneth McDonald kenneth.m.mcdonald at sbcglobal.net
Sun Aug 21 12:56:59 EDT 2005


I could've sworn python had such a command, but now I can't find it...

I'm looking for an easy way to perform a UNIX-style "touch", to  
update the modification time of a file without actually modifying it.  
I could do something (I imagine) like opening the file for appending  
and then immediately closing it, but that doesn't seem like a good  
idea--what if the file is already open for reading or writing? Anyone  
know of a nice, elegant solution?

Thanks,
Ken



More information about the Python-list mailing list