I have a script that is intended to be run by multiple users on multiple computers, and they don\'t all have their Dropbox folders in their respective home directories. I\'d
There is an answer to this on Dropbox Help Center - How can I programmatically find the Dropbox folder paths?
Use ~/.dropbox/info.json
or %APPDATA%\Dropbox\info.json
Access the valid %APPDATA%
or %LOCALAPPDATA%
location this way:
import os
from pathlib import Path
import json
try:
json_path = (Path(os.getenv('LOCALAPPDATA'))/'Dropbox'/'info.json').resolve()
except FileNotFoundError:
json_path = (Path(os.getenv('APPDATA'))/'Dropbox'/'info.json').resolve()
with open(str(json_path)) as f:
j = json.load(f)
personal_dbox_path = Path(j['personal']['path'])
business_dbox_path = Path(j['business']['path'])
One option is you could go searching for the .dropbox.cache
directory which (at least on Mac and Linux) is a hidden folder in the Dropbox directory.
I am fairly certain that Dropbox stores its preferences in an encrypted .dbx
container, so extracting it using the same method that Dropbox uses is not trivial.