35
7
How can I set the time information of a file to be the same as of another file on OSX / Linux?
35
7
How can I set the time information of a file to be the same as of another file on OSX / Linux?
53
Type:
touch -r FROMFILE TOFILE
That sets the access and modification times of TOFILE to match FROMFILE.
10And note: the infamous "creation time" (aka "ctime") that might hear people say that UNIX systems store for a file is really the "i-node modification time", which virtually useless, and certainly doesn't represent the time the file was created. – Fran – 2012-06-16T15:47:07.533
5The real "creation time" is btime aka "birth time", which some filesystems support but Linux stat() doesn't (yet). – user1686 – 2012-06-16T16:07:20.003
1when using
touch -r
on OSX, the "creation time" (as appears in the "get info" box for a file) becomes the same as "last modified" time. i.e. it seems that the FILE1 creation time gets ignored/lost in the process – GJ. – 2012-06-17T11:38:18.1631@Fran I wasn't aware of how ctime works. I found a good explanation of it here.
http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html
– Joe – 2012-06-18T19:58:48.463