Thursday, December 15, 2016

File Copy - File copy options



If you are currently copying files from one directory to another within the same server using:

    cp –p  <path-of-riginated-file> <new-destination-of-file>

please change your code to do:

    cp --preserve=timestamp <path-of-riginated-file> <new-destination-of-file>

The command “cp –p” preserves the original permissions as well as the original timestamps, while “cp --preserve=timestamp” only preserver the original timestamp but not the permissions. We don’t want to preserve the original permissions; we want the permissions of the files controlled by the directory the files are in.

No comments:

Post a Comment