I would like to change all dates on a file [all four reported by stat
command].
I cannot find a way to change the "inode last changed" date.
I've tried:
touch -t
SetFile -d
SetFile -m
but this single date remains unchanged.
Also, is there any way to move file between directories and leave all of the dates intact?
I am moving whole directories, with lots of files inside, so I would prefer to have a single command to do so, if not – I will read the date upfront and set it after the move.
Best Answer
You cannot control
ctime
.ctime
is set with the creation of theinode
.ctime
changes to themtime
when you modify a file.ctime
is set to the current date and time when you modify theinode metadata
, such as changingmtime
, file permissions, or renaming a file.The closest you can come to matching
atime
,mtime
, andctime
would be totouch
a file which will set all three to the current date and time. But at anytimectime
may change, even OS X applications can cause changes to theinode metadata
without changing the content of a file.btime
orbirthtime
will not change when moving files on the same filesystem.Tools that support preserving file metadata are
ditto
,pax
, andcp
with the p option. None of these tools support preservingbirthtime
across filesystems.