I have a directory I want to sync over the cloud using a service like Dropbox. But, within that folder, I only want to sync directories that match a particular pattern.

For instance, sync all folders except folders named node_modules.

Do you know of any way to do this? Here are some ideas I had, and their pitfalls:

  1. Using any sync service, say, Dropbox, set up an AppleScript to watch changes in some directory on my computer. If the change is not in node_modules, push it over to the Dropbox folder location. Issues: Does not have two-way sync.

  2. Solve the issue of #1 by utilizing rsync in some clever way. Issues: Race condition handling? I'm worried about two computers modifying the same file within too short a time frame, and rsync freaking out.

Have you dealt with this issue before? What's your solution?

To clarify, this isn't about excluding a single, or even a finite number of directories. I want to exclude any and all directories/files that match a given pattern, wherever they may be in the folder. So I might have 1000 node_modules directories within my synced directory, and they are all excluded.


Install a software called syncback

1 - Create a New Profile

2 - Choose Synchronize

3 - Click on Change Filter

enter image description here

4 - Click to Add a folder NOT to copy

5 - Type *\node_modules\

(Click on help to see advanced rules for filters, very important!)

enter image description here

6 - Confirm that changes will work (Created a test folder to try out rules)

enter image description here

Click Ok.


  • This is the sketchiest looking software I've ever seen. But it just might work. I'll take a closer look at it over the weekend. I really appreciate the thoroughness with which you responded – thanks for that. Awww shucks, Windows only! I'm on OSX. But I'm glad to see that solutions do exist... – jamesplease Dec 19 '13 at 23:33
  • Np. It's a shame it work for you, hopefully for someone else though. – riseagainst Dec 19 '13 at 23:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.