Best way to 'touch' a file?
Peter Hansen
peter at engcorp.com
Mon Aug 22 20:12:00 EDT 2005
Fredrik Lundh wrote:
> Peter Hansen wrote:
>>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.
You've quoted selectively. He also said "Unix-style 'touch'", from
which one could quite legitimately infer he wants the other features of
the Unix touch command, including the automatic creation of missing files.
Unless you know something more about the OP's needs than he's posted
publicly, you're just guessing too... even if we both agree yours is the
more likely interpretation.
-Peter
More information about the Python-list
mailing list