Created
July 13, 2011 06:19
-
-
Save wahyusumartha/1079819 to your computer and use it in GitHub Desktop.
ruby dropbox uploader
This file contains hidden or 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
require 'rubygems' | |
require 'dropbox' | |
CONSUMER_KEY = "YOUR-CONSUMER-KEY" | |
CONSUMER_SECRET = "YOUR-SECRET-KEY" | |
DROPBOX_SESSION_FILE = "/Users/wahyusumartha/Documents/mongodb-db/script/dropbox_session.txt" | |
# Using when we do not have session | |
# session = Dropbox::Session.new("#{CONSUMER_KEY}", "#{CONSUMER_SECRET}") | |
# session.mode = :dropbox | |
# puts "Visit #{session.authorize_url} to log in to Dropbox. Hit enter when you have done this." | |
#session.authorize | |
# Read from Previous Session | |
session = Dropbox::Session.deserialize(File.read("#{DROPBOX_SESSION_FILE}")) | |
session.mode = :dropbox | |
file_upload = ARGV[0] | |
session.upload("#{file_upload}", '/mongodb-backup') | |
puts "File has been upload to dropbox under /mongodb-backup directory" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment