I wholeheartedly recommend
rsync. It can automatically detect what files are missing on the destination compared to the source and copy only them. IIUC, it's the best solution for your use case. In your case
cp is useless because it will always copy all files and will be much slower than
rsync. If you will understand how
rsync works it will prove to be the best solution for copying large set of data in any case.
Just note that if you decided to use
rsync via network in the future it must be installed both on source and destination machines. This is the only drawback of
rsync known to me.
rsync usage is very simply. Usually it comes down to the following command:
$ rsync -avz <SOURCE> <DESTINATION>
-a means archive mode - copy directory recursively and recreate symlinks, save permissions, modification times, groups ownerhsip, owners,
-v means verbose,
-z means compress
When downloading, temporary files names are prepended with
.. Next time the same command will be run only files that have been changed locally and new files that appeared in
DESTINATION will be downloaded from
It's easy to use
$ rsync -avz -e ssh hosting:/home1/rkumvbrh/mail/drabczyk.org/arkadiusz .
-e ssh can be omitted because ssh is the default:
$ rsync -avz hosting:/home1/rkumvbrh/mail/drabczyk.org/arkadiusz .
rsync via network it must be installed on bothe ends:
$ rsync -avz -e "ssh" router:<FILE> .
ash: rsync: not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(226) [Receiver=3.1.0]
Ok, at first I thought that you want to replace all files that got corrupted on your local disk with files from an external disk and copy all new files from external disk. But if you want to copy only new files from your internal disk to an external disk you must add
--ignore-existing option so that new files will be copied to an external disk but corrupted files will not:
$ rsync -avz --ignore-existing <PATH/TO/INTERNAL_HDD> <PATH/TO/EXTARNAL_HDD>
This tells rsync to skip updating files that already exist on
the destination (this does not ignore existing directories, or
nothing would get done). See also --existing.
This option is a transfer rule, not an exclude, so it
doesn't affect the data that goes into the file-lists, and
thus it doesn't affect deletions. It just limits the files
that the receiver requests to be transferred.
This option can be useful for those doing backups using the
--link-dest option when they need to continue a backup run that
got interrupted. Since a --link-dest run is copied into a new
directory hierarchy (when it is used properly), using --ignore
existing will ensure that the already-handled files don't
get tweaked (which avoids a change in permissions on the
hard-linked files). This does mean that this option is only
looking at the existing files in the destination hierarchy