Created
July 19, 2011 00:18
-
-
Save kirkegaard/1091014 to your computer and use it in GitHub Desktop.
quick and dirty rsync backup script in ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'colored' | |
dest = '/Volumes/Drobo/BACKUP/' | |
logfile = '.sync/log' | |
folders = [ | |
'~/Development', | |
'~/Documents', | |
'~/Pictures', | |
'~/Music', | |
'~/Sites', | |
'~/Work', | |
] | |
if !File.directory?(dest) | |
return false | |
end | |
puts 'Syncing...'.yellow | |
cmd = 'rsync -avr --exclude=".DS_Store" ' + folders.join(' ') + ' ' + dest | |
log = %x{#{cmd}} | |
File.open(logfile) {|f| f.write log } | |
puts 'Syncing complete!'.green |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment