PDA

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




techmonkey
Mar 23, 2008, 10:13 PM
How can I change a files "Date Modified" with Terminal or Applescript?



ChrisA
Mar 23, 2008, 10:20 PM
How can I change a files "Date Modified" with Terminal or Applescript?

Read the man page for "touch"

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

lee1210
Mar 23, 2008, 10:40 PM
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

techmonkey
Mar 23, 2008, 10:42 PM
Read the man page for "touch"

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

Thanks :)

BTW, did I post to the correct forum?

lee1210
Mar 23, 2008, 11:03 PM
Thanks :)

BTW, did I post to the correct forum?

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 =).