hayne
08-31-2005, 12:16 PM
I believe touch is capable of this, if I can access the create time.
You could get the creation time by parsing the output of '/Developer/Tools/GetFileInfo' (installed along with XCode)
assuna
09-01-2005, 09:26 AM
hi ceashton and hayne
some time ago i posted a question here about changing creation and modification time of files. i wanted to create a script that changes the year of the creation/modification time. the reason for this was a crash on a harddisk, that changed all the residing file's creation and modification times to 28 years in the future...
i got some hints and went digging on. i found out that the gui layer of macos x treats modification and creation times differently than the unix layer.
an example:
finder tells me:
created 8. Sep. 2000
changed 8. Sep. 2000
stat -x (shell utility) tells me:
Access: Thu Sep 1 15:51:28 2005 (this is now, as i am accessing it with stat)
Modify: Fri Sep 8 14:41:00 2000
Change: Wed Aug 31 23:05:55 2005
GetFileInfo tells me:
created: 09/08/2000 14:41:00
modified: 09/08/2000 14:41:00
perhaps i do not get the point what is the difference between "change" and "modification". can someone explain?
anyway: if you want to change modification time with touch, you can do:
touch -t ccyymmddhhMM[ss] dragyourfilefromfinderwindowhere
ccyymmddhhMM[ss] means a string of numbers that represent the new date:
cc=century (eg. 20)
yy=year (eg. 05)
mm=month (eg. 09)
dd=day (eg. 01)
hh=hour (eg. 15)
MM=min. (eg. 23)
[ss]=sec. (eg. 20) not necessary!
alltogether: 200509011523, this is today.
hope it helps!