Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy files while skipping over files that exist - Unix [closed]

I'd like to take a large folder (~100GB) and copy it over to another folder. I'd like it to skip any files that exist (not folders) so if /music/index.html does not exist it would still copy even though the /music directory already exists.

I found this, but my shell is saying -u is not a valid argument.

I don't know how rsync works, so please let me know if that's a better solution.

Thanks.

like image 525
switz Avatar asked Dec 06 '11 01:12

switz


1 Answers

Always use rsync for copying files, because It Is Great.

To ignore existing files:

rsync --ignore-existing --recursive /src /dst 

Do read the manual and search around for many, many great examples. Especially the combination with ssh makes rsync a great tool for slow and unreliable connections on account of its --partial option. Add --verbose to see which files are being copied. Be sure to check out the plethora of options concerning preservation of permissions, users and timestamps, too.

like image 67
Kerrek SB Avatar answered Oct 17 '22 01:10

Kerrek SB