How to change a file's date/timestamp?

Discussion in 'Python' started by pythos, Aug 20, 2004.

  1. pythos

    pythos Guest

    How do you change a file's last-modified date and timestamp in Python?
    pythos, Aug 20, 2004
    #1
    1. Advertising

  2. pythos

    Peter Hansen Guest

    pythos wrote:

    > How do you change a file's last-modified date and timestamp in Python?


    utime(...)
    utime(path, (atime, utime))
    utime(path, None)

    Set the access and modified time of the file to the given values.
    If the second form is used, set the access and modified times to the
    current time.


    This and many other functions are in the 'os' standard module, one
    of the few very very widely used and useful modules... you should
    read the online docs for it, along with "sys", and "time" at least,
    before doing any more coding. ;-)

    -Peter
    Peter Hansen, Aug 20, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. [XaToA]
    Replies:
    1
    Views:
    410
    Roedy Green
    Jul 30, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,193
    Michael Borgwardt
    May 30, 2004
  3. praba kar

    change the date string into timestamp

    praba kar, Apr 9, 2005, in forum: Python
    Replies:
    2
    Views:
    398
    Fabio Pliger
    Apr 9, 2005
  4. Fredrik Lundh

    Re: change the date string into timestamp

    Fredrik Lundh, Apr 9, 2005, in forum: Python
    Replies:
    0
    Views:
    367
    Fredrik Lundh
    Apr 9, 2005
  5. Replies:
    0
    Views:
    210
Loading...

Share This Page