Storing vendor directories outside of Dropbox.
As a developer, I have a lot of small projects. Proof-of-concepts, simple tools, examples to help explain things.
In order to synchronize these across different computers, the projects directories all live in Dropbox.
Recently it occurred to me that this means all of the vendor code also lives in Dropbox.
By running the command below, I got an idea of the amount of space all of that vendor code uses in my Dropbox.
du --human-readable --summarize --total $( \
find ~/Dropbox -type d \( -name 'node_modules' -o -name 'vendor' \) \
)
This yielded 3.5GB of space. 😱
Dropbox offers a command-line tool that has the ability to exclude certain files or folders. The downside is that the first time a folder is marked to be excluded from synchronizing with Dropbox, it is removed. However, after that, when a vendor
folder is added again, it is no longer synchronized.
The command to stop Dropbox from synchronizing a file or filder is:
dropbox exclude add path/to/file/or/folder/
Any specified path must be within the Dropbox folder.
By combining find
and xargs
it becomes trivial to exclude vendor folder at once:
find ~/Dropbox -type d \( -name 'node_modules' -o -name 'vendor' \) -print0 | xargs -0 -n1 dropbox exclude add
As stated before, this will remove all vendor
and node_modules
directories so make sure to run find
without piping to xargs
to doublecheck nothing important gets nuked!
By periodically running this command, new vendor directory will also become excluded.