File Exchange

image thumbnail

dropboxPath.m

version 1.1.0.0 (1.13 KB) by christhechris
Get path to dropbox folder of current user.

1 Download

Updated 28 Aug 2014

View License

This function returns the path to the Dropbox folder of the current user (if it exists).
This is read from the dropbox host.db database, assuming it is in the default location.
for unix/mac
~/.dropbox/host.db
for windows
%APPDATA%\Dropbox\host.db

Base 64 decode used code from "Byte encoding utilities" (File ID: #39526).

Tested on OSX 10.9 and Win 7 with Dropbox 2.10.27 (personal account only, I have no idea what host.db looks like for business account).

Comments and Ratings (3)

Babak Nasr

The function needs to be updated. In some case of Windows OS, the "host.db" file may not be in the APPDATA path (the Roaming path) but in the LOCALDATA path (The Local path).
so I suggest to add the following lines after defining hostdb for the WindowsOS:

if ~isfile(hostdb)
hostdb=fullfile(getenv('LOCALAPPDATA'),'Dropbox','host.db');
end

JiaDa

Updates

1.1.0.0

You can add arguments in similar style to fullfile to get a path within a dropbox folder, i.e.
dbpath = dropboxPath(filepart1,...,filepartN).

Note this requires the "strjoin" added in 2013a.

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Acknowledgements

Inspired by: Byte encoding utilities