If I copy some file from some place to another using
cp, the timestamp on the copied file is set to the time of the copy.
Is there some way to avoid this?
I need to copy files without altering their timestamps.
There are three times on a Unix filesystem, the access time (atime), the modification time (mtime), and the inode change time (ctime). You can change the access time and the modification time with the touch program, for example
cp orig copy touch -r orig copy
However, you cannot change the inode change time.
I recently needed to do something similar but using symlink instead.
To create a symlink and preserve the orignal timestamp:
Be aware though that this syntax is probably not supported on other Unices. An alternative could be to use the