Skip to content

Instantly share code, notes, and snippets.

@mkroman
Forked from kirkegaard/sync.rb
Created July 19, 2011 00:20
Show Gist options
  • Save mkroman/1091016 to your computer and use it in GitHub Desktop.
Save mkroman/1091016 to your computer and use it in GitHub Desktop.
quick and dirty rsync backup script in ruby
#!/usr/bin/env ruby
# encoding: utf-8
require 'colored'
folders = %w{~/Development ~/Documents ~/Pictures ~/Music ~/Sites ~/Work}
log_path = ".sync/log"
destination = "/Volumes/Drobo/BACKUP/"
if Directory.exists? destination
puts "Synchronizing...".yellow
output = %x{rsync -avr --exclude=.DS_Store #{folders.join ' '} #{dest}}
open(log_path) {|log| log.write output and puts "Synchronization completed.".green }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment