I back up certain directories on a nightly basis to a local NAS using rsync. Because of a recent problem I had on my machine, I decided to also make a complete copy of the local directory that contains my local files. All copies are a cron job running as root. I would like the original an backup files to have the same timestamps and ownership permissions along with everything else, so initially I used cp -rp (filename) (filename.backup). Running a diff on the two directories shows a significant number of differences. I tried to add an "L" option to follow links or a "d" option to just include the links with the same result. I even tried deleting the backup file prior to the copy with similar results. Can someone suggest a proper way to make a copy that will pass a diff test?

Thank you.

  • You really probably ought to look at using rsync instead of cp ... – ivanivan May 25 at 17:05
  • You could tar files and directories and use tar --diff. See linux.die.net/man/1/tar – Michael D. May 25 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.