Using rsync moving files and folders between linux

If you want to move a folder or file from under same machine, then mv will be enough, but if you want to move from machine A to machine B or different hard-drive, then rsync will be your best friend~~.

Using rsync move a file and remove origin files and folder

rsync -avh --progress --remove-source-files phpMyAdmin/* ../phpMyAdmin/

// You can do a second sync with --checksum to tell it to verify the results of the first synchronization
// Delete –delete Option
touch test.txt
rsync -avz --delete [email protected]:/var/lib/rpm/ .

// Target has the new file called test.txt, when synchronize with the source with ‘–delete‘ option, it removed the file test.txt.
// Copy/Sync a File on a Local Computer

rsync -zvh backup.tar /tmp/backups/
// Copy/Sync a Directory on Local Computer
rsync -avzh /root/rpmpkgs /tmp/backups/
// Copy/Sync a Remote Directory to a Local Machine

rsync -avzh [email protected]:/home/tarunika/rpmpkgs /tmp/myrpms
// Rsync over SSH

rsync -avzhe ssh [email protected]:/root/install.log /tmp/
// Undo option, if you really need this option

rsync --dry-run --remove-source-files -zvh backup.tar /tmp/backups/