How to copy files in Ubuntu and skip files if they are already in the destination

I usually backup my work to an external hard drive. Since this is a weekly task, I want to be able to copy only the files which had changed in the past week rather than copying all the files all over again. The file explorers in Ubuntu/Linix Mint are very stable but the GUI does not have an option to meet this requirement of mine.

Thanks to the CP command I am able to get this done. Here is the command that I use.

The parameters used with the CP command mean the following.

-r copy directories recursively
-u copy the source file only if the destination file is missing or if it is newer than the destination file
-p preserve the timestamps, ownership of files.

The only drawback of CP is that it does not print the status of file copy when it is copying the files to the destination. Commands like pv and rsync have this option. Since I don’t want to monitor it when the files are being copied, file copy progress does not matter much.

By | 2017-04-17T06:43:43+00:00 April 21st, 2017|Linux, operating systems|0 Comments

Leave A Comment