Search code examples
unixsolarisfile-rename

Rename a file but keeping the orginal creation, modification time in UNIX


Is there any way to rename a file while keeping the original creation / modification/ read time? This is in Solaris.

Thanks in advance.


Solution

  • I don't think you can do that with mv. However, you can with cp -p; copy the file to a new name, then delete the original. The -p flag preserves timestamps.

    You will get a new inode though... something you wouldn't with mv