How do I change the modified time of a file in my program/script?

Discussion in 'Mac Programming' started by techmonkey, Mar 23, 2008.

  1. macrumors 6502a

    Joined:
    Jun 8, 2007
    #1
    How can I change a files "Date Modified" with Terminal or Applescript?
     
  2. macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #2
    Read the man page for "touch"

    Type "man touch" without quotes at the terminal. There are some options
     
  3. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #3
    ChrisA's response is the right answer. You didn't specify if you, by hand, once, wanted to do this, or if you needed it done programatically. If programatically, you can do it with utime().

    Again, the manpages are your friend. 'man utime' should get you started.

    -Lee
     
  4. thread starter macrumors 6502a

    Joined:
    Jun 8, 2007
    #4
    Thanks :)

    BTW, did I post to the correct forum?
     
  5. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #5
    Probably close enough. If you phrase the question:
    How do I change the modified time of a file in my program/script?
    That would definitely qualify.

    If you asked:
    What command do I run to change the modified time of a file?
    Not really, even though it's sort of the same question.

    You mentioned applescript, that seems good enough for me =).
     

Share This Page