Peter Hansen wrote: > And, depending on your needs, quite ineffective: > > >>> import os > >>> os.utime('missing.file', None) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > OSError: [Errno 2] No such file or directory: 'missing.file' > > >>> from path import path > >>> path('missing.file').touch() > >>> path('missing.file').exists() > True > > I guess it depends on whether "touch" implies creation-when-missing, as > with the command line version, or just updating the time.
the OP wanted "to update the modification time of a file without actually modifying it". os.utime does exactly that; no more, no less, and no extra dependencies. </F> -- http://mail.python.org/mailman/listinfo/python-list