-
rsync Linux man page:
https://linux.die.net/man/1/rsync -
rsync -navur “sourceDir/” “targetDir”.
-n: dry run
-a: archive
-v: verbose
-u: newer
-r: recursion - rsync filter rules only apply to the first match.
# "test" will be included: rsync -av --include="test" --exclude="test" "source" "target"
- rsync filter rules do not consider directories in source or target.
# "subDir" will not be matched or filtered out: rsync -av --exclude="subDir" "source/subDir/" "target/subDir"
- rsync filter rules for include pattern only work step by step.
# Without the first two include, the 3rd one won't match anything rsync -navur --include='Melanie/' --include='Melanie/temp/' --include='Melanie/temp/**' --exclude='*' "/mnt/d/" "/mnt/e"
- rsync filter rule patterns does not expand * with /, only ** expands /.
# source/dir1/dir2/dir3 won't be excluded rsync -avr --exclude="dir1/*" "source/" "target" # source/dir1/dir2/dir3 will be excluded rsync -avr --exclude="dir3/**" "source/" "target"