Saturday, October 31, 2009

Use rsync to backup files

Since I have moved to Ubuntu, I am able to use rsync to backup files from my laptop to my external HDD very simply. In fact I do the same at work using cygwin on WinXP Pro!


I use the following command to verify which files will be copied to the external HDD:
rsync -cnrv --exclude-from=~/sync/exclude_patterns.txt /<source_folder>/ /<dest_folder>/


And once I am ok with the list, I run the command without the "-n" option as:
rsync -crv --exclude-from=~/sync/exclude_patterns.txt /<source_folder>/ /<dest_folder>/


Explanation of Options:
  • -c: Use checksum, ot modification date & time to compare files
  • -n: Dry Run - perform a trial run without any changes
  • -r: Recurse into sub-directories
  • -v: Verbose - give detailed output
  • --exclude-from: Use the file patterns given in the file to exclude files from source
  • trailing / in paths: Do not create the current folder - copy it's contents

There are many other options - checkout the man page for other great features of rsync.

No comments:

LinkWithin

Related Posts Plugin for WordPress, Blogger...