14

I have been keeping my vim files in Ubuntu One and since I have a lot of plugins installed as git submodules (or however vundle installs them) and I'm only interested in updating these repositories on my main computer, I had set Ubuntu One to ignore these files using:

ignore = \A.*\.git\Z

in ~/.config/ubuntuone/syncdaemon.conf so it won't have to sync thousands of files. Now I'm trying to move these files to dropbox instead but I couldn't find an equivalent setting in dropbox.

So my question is, how can I tell dropbox to ignore files/folders with certain names (particularly the dot folders)?

2

6 Answers 6

11

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.
4

Dropbox has a Selective Sync feature that you can look to configure

Couple of tools that I found, that talk about achieving this via config files-

  1. Dropboxfilter
  2. Dropboxignore
2
  • These certainly look interesting. As far as I understand, (0)selective sync requires me to explicitly disable some folders which would make my job difficult if I want to change my installed plugins. (1)Dropboxfilter says I need an empty dropbox folder which is not feasible for me atm. (2)Dropboxignore looks like a windows program (got only .exe downloads and .sln files in the source) and I'm working in ubuntu.
    – none
    Mar 9, 2013 at 14:21
  • 2
    Dropboxfilter looks like it's a dead project; I tried it out months back and it just didn't work reliably for me.
    – Heptite
    Mar 9, 2013 at 19:33
2

Dropbox seems to be working on a feature that would finally solve the issue https://help.dropbox.com/en-us/files-folders/restore-delete/ignored-files

But until then check out this solution here: https://stackoverflow.com/a/60104539/1768033 Which works way better than selective sync.

1

Since 2020 Dropbox has to option to ignore files and folders (https://help.dropbox.com/files-folders/restore-delete/ignored-files).

I use the following bash script in my Dropbox folder on MacOS to find all .git folders and parent node_modules folders in the Dropbox folder and mark these to be ignored:

# for MacOS
# exclude-files-dropbox.sh
find . -type d -name "node_modules" -prune -exec xattr -w com.dropbox.ignored 1 {} \;
find . -type d -name ".git" -prune -exec xattr -w com.dropbox.ignored 1 {} \;

The following should work on Linux:

# for Linux
# exclude-files-dropbox.sh
find . -type d -name "node_modules" -prune -exec attr -s com.dropbox.ignored -V 1 {} \;
find . -type d -name ".git" -prune -exec attr -s com.dropbox.ignored -V 1 {} \;
0

It's possible to do this with rsync! I'm successfully running this right now, excluding all node_modules and other vendor files. I write a guide for this: https://arshaw.com/exclude-node-modules-dropbox-google-drive

0

Each git repo stores all its files in a .git folder under the project folder. Using the exclude command in the dropbox client, you can specify all of these files using the * (wildcard) like this, down to a specific depth in your file structure:

cd ~
dropbox exclude add Dropbox/.git
dropbox exclude add Dropbox/*/.git
dropbox exclude add Dropbox/*/*/.git
dropbox exclude add Dropbox/*/*/*/.git
dropbox exclude add Dropbox/*/*/*/*/.git

This will exclude all of your git files down to 5 sub-folders deep. Then, when you make a new repo you can add that file directly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .