Stop Syncing Folders in Dropbox

Keagan Chisnall
2 min readMar 3, 2020

--

https://www.dropbox.com/

So I’ve been a Dropbox user for a long time; but when I started development, I ran into a problem: ☠ node_modules ☠. If you don’t know what that means, it’s an automatically generated folder of thousands of little files that clogs up Dropbox syncing (and space); but more importantly, has no real value in being backed up.

Terminal Method

Now Dropbox doesn’t (yet) have a way to automatically exclude specifically named folders (e.g. node_modules) but there is a way to manually exclude a folder/file using Terminal (Mac) or PowerShell (Windows).

MAC: xattr -w com.dropbox.ignored 1 /Users/yourname/Dropbox/path/to/folder/name.pdfWin: Set-Content -Path C:\Users\yourname\Dropbox\path\to\folder\name.pdf  -Stream com.dropbox.ignored -Value 1

** After you have run that you need to pause and restart your syncing or close and re-open the dropbox app.

You can stop here because that’s all you need. But… If you want a script to do that a little faster and don’t want to remember the command, I made one for Windows.

Ask questions below if you have errors/issues. I’ve spent way too long wrestling with this and may be able to help!

Script Method (for Windows)

I’m still teaching myself PowerShell, but this is what I came up with:

You need to make a new text file, add in that code, and the save it as desync.ps1. In Windows 10 you should be able to right click on that and Run with PowerShell

If you don’t use the Run with PowerShell method, you may need to change your “PowerShell Execution Policy” to allow you to run scripts. In short, open up a PowerShell as Administrator and run: Set-ExecutionPolicy Unrestricted

After all that: Move desync.ps1 into the folder you want to exclude from syncing, run it, and follow prompts 😉

Image by Mudassar Iqbal from Pixabay

--

--

Keagan Chisnall
Keagan Chisnall

Written by Keagan Chisnall

I have a background in process engineering, management, and consulting; but my passion is making systems and processes more efficient. Visit me: chisnall.io

No responses yet