I want to overwrite an existing file on Dropbox.
Here's the code I'm using (based on the docs):
require 'dropbox_sdk'
ACCESS_TOKEN = '###'
client = DropboxClient.new(ACCESS_TOKEN)
file = open('/source_folder/file1.csv')
response = client.put_file('/target_folder/file1.csv', file, true)
puts "uploaded:", response.inspect
This does not overwrite the existing file. I check this by looking at the directory it's in. It contains the old version instead of the new.
response.inspect returns:
{"rev"=>"9e6b400e64803", "thumb_exists"=>false, "path"=>"/target_folder/file1.csv", "is_dir"=>false, "client_mtime"=>"Sun, 07 Sep 2014 14:56:35 +0000", "icon"=>"page_white", "bytes"=>14705913, "modified"=>"Sun, 07 Sep 2014 14:56:35 +0000", "size"=>"14 MB", "root"=>"dropbox", "mime_type"=>"text/csv", "revision"=>648884}
What should I try next?
client.get_fileto retrieve the latest version of the file from the server to see what made it there. Also, make sure that your local file (/source_folder/file1.csv) is actually what you expect it to be.