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:
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.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, andrsync
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.
n
folders namednode_modules
, and they aren't necessarily in the root directory. It needs to know to exclude any and allnode_modules
directories and subdirs, not any given one.