1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

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

    #1
    How can I change a files "Date Modified" with Terminal or Applescript?
     
  2. macrumors G4

    #2
    Read the man page for "touch"

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

    lee1210

    #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. macrumors 6502a

    #4
    Thanks :)

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

    lee1210

    #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