Skip to content

Instantly share code, notes, and snippets.

@nemoDreamer
Created August 20, 2014 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemoDreamer/e5d57c4567b0d9246c4b to your computer and use it in GitHub Desktop.
Save nemoDreamer/e5d57c4567b0d9246c4b to your computer and use it in GitHub Desktop.
Sync Steam game-data to Google Drive folder
#!/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
@nemoDreamer
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment