Created
August 20, 2014 15:12
-
-
Save nemoDreamer/e5d57c4567b0d9246c4b to your computer and use it in GitHub Desktop.
Sync Steam game-data to Google Drive folder
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 -w | |
USER = `whoami`.chomp | |
SOURCE = "/Users/#{USER}/Library/Application Support/" | |
TARGET = "/Users/#{USER}/Google Drive/Backups/Steam/in Application Support/" | |
class String | |
def shell_safe | |
self.gsub(/(\s)/, '\\\\\1') | |
end | |
end | |
Dir.foreach(TARGET) do |dir_name| | |
unless dir_name[/^\.+$/] | |
source_path = SOURCE + dir_name | |
if Dir.exist? source_path | |
puts "\n#{dir_name}", "--------------------------------------------------" | |
puts `rsync -razv --exclude SteamApps #{source_path.shell_safe} #{TARGET.shell_safe}` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expects you to already have the folders you want synced stubbed out in
/Users/#{USER}/Google Drive/Backups/Steam/in Application Support/
, so it knows what in~/Library/Application Support
is a Steam game.