Dropbox on linux server - how to include/exclude folders?

Solution 1:

The official Dropbox CLI has an exclude option.

On Linux Dropbox has a client (dropbox) and a deamon (dropboxd).

The client has the exclude command, which you can use to exclude directories. E.g. to exclude node_modules from Dropbox you can enter dropbox exclude add ./node_modules

dropbox help exclude will print the help information:

dropbox exclude [list]
dropbox exclude add [DIRECTORY] [DIRECTORY] ...
dropbox exclude remove [DIRECTORY] [DIRECTORY] ...

"list" prints a list of directories currently excluded from syncing.
"add" adds one or more directories to the exclusion list, then resynchronizes Dropbox.
"remove" removes one or more directories from the exclusion list, then resynchronizes Dropbox.
With no arguments, executes "list".
Any specified path must be within Dropbox.

Solution 2:

I've found the behaviour has changed recently and dropbox exclude now seems to affect the "Selective Sync" i.e "You have a folder on the dropbox cloud that you do not want to sync to the local machine" instead of "You have a folder on the local machine that you do not want to sync to dropbox"

You will want to ignore files instead.

attr -s com.dropbox.ignored -V 1 somefolder

Solution 3:

Imagine a folder on root of Dropbox named "YOURFOLDER"

1 - Tip: cd ~/Dropbox

2 - Press Enter

3 - Tip: dropbox exclude add ~/Dropbox/YOURFOLDER

4 - Press Enter

To confirm

1 - tip: dropbox exclude list

2 - Press Enter

A list of excluded folders will appear:

Excluded: ../../../root/Dropbox/YOURFOLDER