Best way to 'touch' a file?

Steve Holden steve at holdenweb.com
Mon Aug 22 21:18:28 EDT 2005


Peter Hansen wrote:
> 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.
> 

Which we probably all can. It's a right bugger when you actually have to 
listen to what the customer wants, innit? ;-)

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/




More information about the Python-list mailing list