How to rsync only new files
From man rsync
:
--ignore-existing skip updating files that exist on receiver
--update
does something slightly different, which is probably why you are getting unexpected results (see man rsync
):
This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file. (If an existing destination file has a modification time equal to the source file's, it will be updated if the sizes are different.)
In my case I had similar issues, having all files transferred instead of only the modified/new ones. I solved this by using parameters -t
(instead of -a
), and -P
(equivalent to --partial --progress
):
rsync -h -v -r -P -t source target
This transfers only new files, and files already existing but modified: -a
does too much, like user and group ID sync, which in my case can not work as I have different users and groups on my source and target systems.
The parameters in detail:
-h
: human readable numbers-v
: verbose-r
: recurse into directories-P
:--partial
(keep partially transferred files) +
--progress
(show progress during transfer)-t
: preserve modification times