Search code examples
sshfile-management

How to preserve files original creation date?


I'm moving files on the server from one directory to another using the file manager. Is there a way to preserve file creation date/time (when it was first added to server)? Someone suggested SSH, but I'm not very familiar with it. Does anyone have some good instructions on this?


Solution

  • Use scp with the -p option.

     -p      Preserves modification times, access times, and modes from the original file.
    

    Example command copying a file from local to remote server:

    scp -p /home/mylocaldata/test.txt remote.example.com:/home/remote_dir
    

    Note that this will not preserve user and group only permission flags (rwx and such).