rsync options
to get rsync to report progress: –verbose –progress –stats
if copying over network use compression and secure transfer: –compress –rsh=/usr/bin/ssh
tell rsync to copy recursively: –recursive
keep file timestampts: –times
keep permissions: –perms
copy symbolic links: –links
instruct rsync to delete files on the remote location that isn’t present on the source: –delete
to exclude files by a patterns: –exclude “<exclude patterns>” (eg. –exclude “*.bak”) Additional patterns can be specified by adding another –exclude parameter
example command:
sudo rsync –verbose –progress –stats –compress –recursive –times –perms –links /home/thomas/Ph.D/sommerskole/ /media/KBM_BioSysTek/tgi/Storage\ Filer\ findes\ ikke\ andre\ steder/sommerskole/
to copy all files and folders in …Ph.D/sommerskole to …Storage\ Filer\ findes\ ikke\ andre\ steder/sommerskole/
sudo is necessary in this example to write to /media
To instruct rsync to remove files from the source that have been sucessfully transfered add: –remove-source-files
rsync man page states this about –remove-source-files: sender removes synchronized files (non-dir)
using –remove-source-files have not been tested
EDIT: –remove-source-files have been tested with
sudo rsync –verbose –progress –stats –compress –recursive –times –perms –links –remove-source-files /home/thomas/Ph.D/sommerskole/ /media/KBM_BioSysTek/tgi/Storage\ Filer\ findes\ ikke\ andre\ steder/sommerskole/
All files are removed but directories remain
Tags: rsync