Path of the dropbox folder

Is there anyway I can get the path of the dropbox folder?

Typically here, I would imagine:

(function () {
    var a = Application.currentApplication(),
        sa = (a.includeStandardAdditions = true, a);

    return sa.pathTo('home folder') + '/Dropbox/';

but perhaps it's more variable than that …

Generally you can just use ~ as your home folder, so a path like:


If you want the full path, you can just use echo in the Execute Script action:

echo ~/Dropbox

However if you want to find a non-stanard Dropbox location, then you will have to query Dropbox somehow. Actually, a cheat alternative would be to include a dummy uniquely named file in your Dropbox account, and then use mdfind to find it and thus deduce the location of your Dropbox folder.

Currently there is no API to query the Dropbox app (unless something has snuck up on me while I wasn’t looking).

There is an official command-line tool for Dropbox, but as far as I know it is entirely incompatible with the OSX version of Dropbox.

So Peter’s idea of using mdfind is probably the quickest and easiest method:

Put an aptly named file in your Dropbox folder, and run this from an Execute a Shell Script action:

dirname $(mdfind 'kMDItemDisplayName == "myDropboxLocator.txt"')

This takes about 0.05 seconds to return a result on my system.


On my system I have Dropbox in the default location, so this works for me in an Execute an AppleScript action:

set myDropboxPath to POSIX path of ((path to home folder as text) & "Dropbox:")

Peter has mentioned ~/Dropbox
You can put that in a variable and then use the Filter-Variable action to Expand Tilde in Path

Or combining a couple of things we can do this:

if [ -d "$DROPBOX" ]; then
   echo "$DROPBOX"
   dirname $(mdfind 'kMDItemDisplayName == "myDropboxLocator.txt"')

If the Dropbox folder exists in the default location this is sub 0.001 seconds, and if DB is NOT in the default location it falls back to using mdfind.


1 Like

Chris’s idea seems good, and you might be able to use variants of it which (in some circumstances) might reuse the $DROPBOX variable, and perhaps look for a ‘myDropBox’ user tag as an alternative to a special file, or even just assume that the first folder matching “Dropbox” is likely to be the one you are after ?


if [[ -z "$DROPBOX" ]]; then

if [ ! -d "$DROPBOX" ]; then
	DROPBOX=$(mdfind 'kMDItemDisplayName == "Dropbox" && kMDItemContentType == public.folder' | head -n 1)
	# or perhaps using a tag ?
	# DROPBOX=$(mdfind 'kMDItemUserTags == myDropBox && kMDItemContentType == public.folder'  | head -n 1)

echo "$DROPBOX"

Thank you for all these suggestions. My dropbox is not in the default location so I’ll try one of your suggestions.

The path is located in


Got this from

So one solution might look like this, use “Execute a Shell Script” and save it to a variable:

cat ~/.dropbox/info.json | awk '{print $3}' | sed 's/[",]//g'

This read the file, get the third column and then remove the two characters " and ,



That’s awesome simgag! Nice to know that and thanks for the script.

And another approach, using simgag's research, and reading the JSON directly with an Execute JavaScript action:

Dropbox path 2.kmmacros (19.3 KB)

(function () {
  return JSON.parse(

I liked that. nice!

1 Like

Well done Simon!  :smile:


1 Like