Skip to content

Instantly share code, notes, and snippets.

@kirkegaard
Created July 19, 2011 00:18
Show Gist options
  • Save kirkegaard/1091014 to your computer and use it in GitHub Desktop.
Save kirkegaard/1091014 to your computer and use it in GitHub Desktop.
quick and dirty rsync backup script in ruby
#!/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