$HOME/Dropbox

What is $HOME/Dropbox…

… – It depends! On which plan(s) you are using.

At Home

Personal Dropbox service

Sharing

At Work

Company Dropbox service

Comments
$HOME/<Dropbox>/

Where <Dropbox> IS “Dropbox”

$HOME/<Dropbox>/

Where <Dropbox> is “Dropbox ” (including a space)+(company name) , which contains space(s)) – must be considered!

Top-level of ‘Dropbox’ entry in file system
[Dropbox]/Officef ->
should
(from Personal)
[Dropbox]/Office
Software, templates, graphics, … that I’ve developed over decades and that I want to have access both at home and at work.
As an example:
/Users/goham/Dropbox/Office/bin
Corresponding reference:
/Users/goham/Dropbox (Holy Moly Limited)/Office/bin/
[Dropbox]/Research! ->
could
(from Personal)
[Dropbox]/Research!
Depend on business and use (this folder is very big)

$HOME/<Dropbox>/

[Dropbox]/<company dropbox top folder 1>

[Dropbox]/<company dropbox top folder 2>

Bash / Terminal – Config

More also in our Bash – /is/dev/sw/programming/languages/bash/ – section.

Summary

Example (version 21.1.17) shows in .bashrc, but of course can be places in other files (as shown in Bash-section)

# 2020-12-07
# :::bash
DROPBOX_PERSONAL=$(python -c "import json;f=open('$HOME/.dropbox/info.json', 'r').read();data=json.loads(f);print data.get('personal', {}).get('path', '')")
DROPBOX_WORK=$(python -c "import json;f=open('$HOME/.dropbox/info.json', 'r').read();data=json.loads(f);print data.get('business', {}).get('path', '')")

if [ "$DROPBOX_PERSONAL" != "" ] ; then
  DROPBOX=$DROPBOX_PERSONAL
else
  DROPBOX="$DROPBOX_WORK"
fi
# alias dbt='set | grep DROPB '
PATH="$PATH:$DROPBOX/Office/bin"

Potential Location, Directory References

$HOME

# Entry What In Finder Notes
(1h) $HOME/Dropbox Folder Yes Personal account, at home, no fuzzing with spaces, just ‘Dropbox’, easy to use
(1w) $HOME/Dropbox (Holy Moly Limited) Folder Yes Created and maintained by Dropbox app, spaces always needs some special considerations
(2w $HOME/Dropbox (Holy Moly) Symbolic link to (1w) No Not sure when came about

Dropbox (Holy Moly Limited)
lrwxr-xr-x    1 goham  staff         43 Aug  6 15:22 Dropbox (Holy Moly) -> /Users/goham/Dropbox (Holy Moly Limited)

 

R&D

$HOME/Dropbox – bad idea, unfortunately, as doesn’t work with company plans

Ok, will wort on a simple personal Dropbox setup/account

im2720:~$ ll $HOME | grep -i dropb
drwx------@ 30 goham staff    960 Jan 16 06:12 Dropbox/

But NOT on company plan

mpb17:~$ ls -l $HOME
...
drwx------@  24 goham  staff        768 Oct 21 03:51 Dropbox (Holy Moly Limited)
lrwxr-xr-x    1 goham  staff         43 Aug  6 15:22 Dropbox (Holy Moly) -> /Users/goham/Dropbox (Holy Moly Limited)

So, what to do?

https://help.dropbox.com/installs-integrations/desktop/locate-dropbox-folder

 

 

mbp17:~$ cat ~/.dropbox/
Crashpad/        events/          instance1/       machine_storage/
QuitReports/     host.db          instance_db/     metrics/
dropbox.pid      info.json        logs/            unlink.db
mbp17:~ $ cat ~/.dropbox/info.json 
{"business": {"path": "/Users/goham/Dropbox (Holy Moly Limited)", "host": 59111958000, "is_team": true, "subscription_type": "Business"}}mbp17:~ $ 

 

https://ryanmo.co/2014/08/31/global-shell-variables-for-dropbox-paths/

Global Shell Variables for Dropbox Paths

POSTED ON 2014-08-31

I have multiple computers running Dropbox, all of which have different folder paths to where the Dropbox folder is located. I wanted to have a universal way to find and navigate to the folders regardless of what computer I was on.

In most cases, setting a variable to your Dropbox path is relatively easy. You could set your .bashrc to look something like this

:::bash
DROPBOX_PERSONAL=$HOME/Dropbox

But this fails in a few situations, all of which apply to me on one or more of my computers

  • Multiple Dropbox accounts on one computer (Personal and Business accounts)
  • Dropbox isn’t located in my home folder

If you’re running Dropbox version 2.8 or higher (you should be anyways), there’s a json file that tells you where your Dropbox folders are located. The json looks like this:

:::bash
{
    "personal": {
        "path": "/Users/username/Dropbox (Personal)",
        "host": 1234
    },
    "business": {
        "path": "/Users/username/Dropbox (Business)", 
        "host": 5678
    }
}

What this means is that you can set global variables using this information in your .bashrc or .bash_profile so that you always know where your Dropbox folder is

:::bash
DROPBOX_WORK=$(python -c "import json;f=open('$HOME/.dropbox/info.json', 'r').read();data=json.loads(f);print data.get('business', {}).get('path', '')")
DROPBOX_PERSONAL=$(python -c "import json;f=open('$HOME/.dropbox/info.json', 'r').read();data=json.loads(f);print data.get('personal', {}).get('path', '')")

Now all you have to do is reference your Dropbox folders with $DROPBOX_PERSONAL or $DROPBOX_WORK.

2022-06-03 MODIFICATION FOR macOS with newer Python implementation:

DROPBOX_PERSONAL=$(python3 -c “import json;f=open(‘$HOME/.dropbox/info.json’, ‘r’).read();data=json.loads(f);print( data.get(‘personal’, {}).get(‘path’, ”))“)
DROPBOX_WORK=$(python3 -c “import json;f=open(‘$HOME/.dropbox/info.json’, ‘r’).read();data=json.loads(f);print( data.get(‘business’, {}).get(‘path’, ”))“)