Kenneth McDonald wrote:
> 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?

from path import path
path('myfile').touch()

(That relies on Jason Orendorff's path.py module, which does this and 
much more very elegantly, not to mention practically.)

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to