Skip to content

Instantly share code, notes, and snippets.

@tamboer
Last active December 22, 2015 16:39
Show Gist options
  • Select an option

  • Save tamboer/6501100 to your computer and use it in GitHub Desktop.

Select an option

Save tamboer/6501100 to your computer and use it in GitHub Desktop.
rsync
rsync -avh /tmp/foo/ root@host2:/tmp/bar
http://www.evbackup.com/support-commonly-used-rsync-arguments/
I am having Folder A on my computer which is constantly updated with content.
Another Folder B is used for backup purpose which is on external HDD.
Now what I expect is that whatever extra which is present in folder A should go to folder B.
However something which is present in B and NOT in A ""shall NOT be copied to A"".
In a nutshell, the backup folder may copy everything from the source folder, however nothing should be copied form backup folder to the source.
sudo rsync -az /path_to/A /path_to/B
sudo rsync -az /path_to/A /path_to/
-a archive mode (implies recursive, copy symlinks as symlinks, preserve owner, modification times, group, owner, special and device files)
-z compresses the data
If you wish to remove files deleted in A from files in B, use the --delete option
For additional information see https://help.ubuntu.com/community/rsync
You can run rsync from cron
sudo crontab -e
Add in an hourly task
@hourly rsync /path_to/A /path_to/B
https://help.ubuntu.com/community/CronHowto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment