Dropbox Ignore Folder Node_modules

  1. Add Folder In Dropbox
  2. Dropbox Sync Specific Folders
Folder

In this blog post we show you how to implement an OAuth authorization code grant flow using Node.JS and Dropbox JavaScript SDK. While publishing code in VCS / Drive / Dropbox dont include nodemodules folder. All the modules will be reinstalled using npm install. But make sure that all your neccessary modules were included in package.json dependencies. For an example, User A adding source in VCS/Drive/Dropbox without nodemodules. The way it works is that if you ignore the file/s or folder/s when you set the flag Dropbox will ignore it completely from syncing. If you un-ignore it, it will treat normally as any other.

Actually this problem isn't only about NodeJS development and the node_modules folders, but this is where it's the most pain. It's more about having any kind of way to download and generate a ton of files within seconds and afterwards waiting for hours, or even days for Dropbox to sync those files. While you actually wouldn't need it as you could get them instantly again at any later point with one or few small commands.

When installing packages via npm you sometimes get millions of files and, if you want to keep the folders in sync between different computes, you might think about going with Dropbox. Well, it's not a good idea. At the time of this writing, Dropbox took almost two days to index and upload all those files to the cloud and was only somewhere half-way through, downloading it on the other machine.

  1. Configuring sync services so that they ignore directories named nodemodules. Alas, the basic versions of Dropbox, iCloud, and Google Drive don’t let you do that at the moment. Bidirectionally synchronizing into a cloud directory and ignoring nodemodules while doing so. We’ll look into (3) next.
  2. This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLIDropbox CLI.

Alternative titles could be:

  • Ignore files in Dropbox

  • .gitignore for Dropbox

The Solution:

TL;DR - I went with BitTorrent Sync in the end. And this is how I got there:

A short Google search showed that several people were having the same problem and looking for solutions. The two solutions I liked the most were:

  • DropboxIgnore - a small bash script which finds all files, you want to ignore and uses the Dropbox CLI to ignore them. However, Dropbox CLI only works in Linux.
  • .dbignore which seems like exactly what I was looking for, but it only works in OS X

Currently I'm synchronizing my MacBook Air and a Linux Laptop together. I could try combining them, but didn't want to mess up everything. So I kept looking for an alternative...

I've found a comment on Hacker News suggesting, that Seafile has this feature, but I already have few sync-solutions installed and running all the time, so I didn't want to introduce yet another one.

Add Folder In Dropbox

Than I realized, that BitTorrent Sync actually has an ignore-file. I was so far only using it to sync Pictures and large iso-files, but I gave it a shot. If you get the latest version of BitTorrent Sync, you have to add the folders you want to ignore to .sync/IgnoreList. If you have version 1.3 or earlier, the file is called .SyncIgnore and is directly in the folder, you are syncing.

This is what I've added to my IgnoreList:

Add folder in dropbox

Dropbox Sync Specific Folders

  • node_modules
  • bower_components
  • target
  • release
  • Release
  • debug
  • Debug

You can find more info on the syntax and everything else in the Sync Help Center.

It scanned my folder with >200,000 files within a minute and started syncing over my local network right after. It took ~half an hour to sync everything locally and is now slowly uploading it to the server.

BitTorrent Sync is a bit difficult to set up compared to Dropbox, as you have to add the folder to every machine you want to use it with, but it works like a charm for now. I also want to add, that I used to have problems with it on Windows, where it just wouldn't sync anything, but Linux and OS X are working fine.