1

I'm need to change the drop box default folder, via command line(because I need to do this in another machine in my local network,so I will access this machine via protocol ssh from the my local machine)to another folder, I search in the Internet and the solution is the same in all the that I find, use this python script:

> #!/usr/bin/env  
> # Script for showing or setting the dropbox folder.
> #
> # Execute without options to show current dropbox folder (if non-default).
> # Execute with --setfolder=/foo/bar to set new dropbox folder.
> #
> # I dedicate this work to the public domain by waiving all my rights to the
> # work worldwide under copyright law, including all related and neighboring
> # rights, to the extent allowed by law.
> #
> # You can copy, modify, distribute and perform the work, even for commercial
> # purposes, all without asking permission.
> #
> # Wim Coenen ([email protected]).

import base64
import optparse
import os
import os.path
import sqlite3

# parse command line options
cmdparser = optparse.OptionParser()
cmdparser.add_option("-s","--setfolder", dest="folder",
  help="set dropbox folder")
(options, args) = cmdparser.parse_args()

db_path = os.path.expanduser("~/.dropbox/dropbox.db")
db = sqlite3.connect(db_path)
cursor = db.cursor()

# get dropbox_path
cursor.execute("select value from config where key='dropbox_path'")  
dropbox_path = "<default>"
for entry in cursor:
   dropbox_path_base64 = entry[0]
   dropbox_path_raw = base64.decodestring(dropbox_path_base64)
   dropbox_path = dropbox_path_raw[1:-5]
print "current dropbox path: %s" % dropbox_path

if not options.folder is None:
   new_path_raw = "V" + os.path.abspath(options.folder) + "\np1\n."
   new_path_base64 = base64.encodestring(new_path_raw) 
   cursor.execute("delete from config where key='dropbox_path'")
   cursor.execute("insert into config (key,value) values (?,?)", \
      ("dropbox_path", new_path_base64))
   db.commit()
   print "new dropbox path: %s" % options.folder
   
db.close()

here it is the tutorial link what I followed: https://whatbox.ca/wiki/Dropbox

So, I'm very newbie with python, when I try execute this script

python ~/Downloads/dropboxdir.py --setfolder=/home/user/new_folder

he returnd this error:

cursor.execute("select value from config where key='dropbox_path'")

sqlite3.OperationalError: no such table: config

So guys, I need a light, any help is welcome.

6
  • 1
    You got a database and you run the script on it. And the error reports that the database has no table "config" inside. How can we solve that problem? The problem resides in the database that lacks the required table. Commented Jan 2, 2017 at 13:21
  • @aronadaal hmm ,I'm understanding...So what I can do add this table? Commented Jan 2, 2017 at 13:34
  • You can add thew table by the create table command but dropbox seems to have chnaged Commented Jan 2, 2017 at 13:55
  • @DouglasDiasdaSilva By default if sqlite3 database does not exists in the path it was accessed, a blank db will be created by sqlite3 libraries. Most likely it is the reason why you are looking at error "table does not exists". I suggest to check if DB exists and if yes, use chrome extension of browsing sqlite3 database and check contents of DB manually before accessing it via program. Commented Jan 2, 2017 at 14:06
  • @VijayakumarUdupa hmmm...interesting, so how I can check if DB exists exactly? I never work with sqlite3... Commented Jan 2, 2017 at 15:06

1 Answer 1

0

The database is an internal part of non open source software. I would assume that the developers of Dropbox have chnaged the structure of the database.

In my case using dropbox version v16.4.30 on OSX the dropbox.db file does not even exist so they have changed it even more

Sign up to request clarification or add additional context in comments.

1 Comment

you mean the developers of sqlite3?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.