Sync files and folders
Usage
rsync <options> <source> <destination>Backup Mode
Perform a mirrored one way sync of source files to destination, removing deleted files from destination (Archive mode flag -a is the same as -rlptgoD)
rsync -avhP --stats --delete <source> <destination>Archive Mode
Perform a mirrored one way sync, deleting destination files but retain a destination backup of deleted files in a date stamped folder
rsync -avhP --stats --delete --backup --backup-dir="backup_$(date +\%Y-\%m-\%d)" <source> <destination>Common Flags
Flags encompassed by archive mode
-rrecurse into subdirectories-lcopy symlinks as symlinks-ppreserve permissions-tpreserve timestamp-gpreserve group-opreserve owner-Dpreserve device and special files
To opt out of an archive mode default flag
--no-<option>(eg.--no-Dto disable-D)
Dry Run
-ndry run what will be transferred
Display Flags
-vverbose output-hhuman readable output-Pshow progress and keep partial files
Transfer Flags
-uskip files that are newer on the receiver-zcompress data during transfer--deletedelete extraneous files from destination dirs--exclude=<pattern>exclude files matching<pattern>
Last updated