rsync -r dir1/ dir2 # -r: recursive # This trailing slash(/) signifies the contents of dir1. Without the trailing slash, dir1, including the directory, would be placed within dir2. rsync -a dir1/ dir2 # -a: archive. recursively and preserves symbolic links, special and device files, modification times, groups, owners, and permissions. rsync -anv dir1/ dir2 # -n or --dry-run # -v: verbose rsync -a ~/dir1 username@remote_host:destination_directory rsync -a username@remote_host:remote_directory local_directory rsync -az source destination # -z: compress rsync -azP source destination # -P: --progress and --partial # --progress: progress bar # --partial: allows to resume interrupted transfers rsync -an --delete source destination # --delete: delete rsync -a --exclude=pattern_to_exclude --include=pattern_to_include source destination # --exclude=pattern_to_exclude # --include=pattern_to_include rsync -a --delete --backup --backup-dir=/path/to/backups /path/to/source destination # --backup # --backup-dir # others # --size-only Compare size only. # --ignore-times File is always copied. This does not mean that modification timestamp is not compared, but that the other items are compared even if the modification timestamp is consistent. # --checksum The checksum is only computed if size matches. Comparison without timestamp
Leave a Reply