cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Create, upload, and share

Find help to solve issues with creating, uploading, and sharing files and folders in Dropbox. Get support and advice from the Dropbox Community.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.dropbox-ignore to prevent folders being uploaded to DropBox like git's .gitignore

.dropbox-ignore to prevent folders being uploaded to DropBox like git's .gitignore

anjanesh
Helpful | Level 6
Go to solution

Just like we have .gitignore for preventing files / folders to be uploaded to github, it would be nice to have the same for DropBox.

I have a workspace folder with tons of node_modules folders.

I want to upload the workspace folder to my DropBox but want to skip the node_modules folders.

Is there a way to achive this by making some .dropbox-ignore entry in my workspace's folders ?

That would be really helpful. Thanks.

17 Replies 17

Darcey
Explorer | Level 4
Go to solution

pCloud has this feature, save yourself some time and just get 2TB on pCloud for life during a sale. Just add node_modules etc etc inside their software client.

anjanesh
Helpful | Level 6
Go to solution

https://stackoverflow.com/a/72978599/126833

 

In case you want to get all of the node_modules that you want to delete in a shell file :

 

find . -name node_modules -type d -print0 | xargs -0 stat -f "rm -rf %N" > rm_node_modules.sh

 

Then in terminal run

bash rm_node_modules.sh

Steve A.13
Helpful | Level 7
Go to solution
Agree we need a way to ignore files and folders. The power shell method is too complex. And I’d like wildcards, so I could ignore *.tmp, *.bak, *.obj, etc files in all folders.

Darcey
Explorer | Level 4
Go to solution

pCloud has this feature, this has been a dropbox request for years, don't waste your time.

Bloodreaver
New member | Level 2
Go to solution

Hello!

 

This will not be an ideal solution for everyone but I find it useful. I am using windows 11 and this works well for me, I basically just use it on my node.js projects' node_modules directory to stop all that junk from being synced.

 

The end result, you can see the node_modules folder is now being ignored:

Artboard 1.png

 

You will need to modify the registry and store some powershell script files somewhere on your system where they won't be moved or deleted etc. You could even store them in your dropbox if you wanted! If you are not comfortable doing this then you will have to find a different solution.

 

There are 4 files to make, 1 registry file and 1 powershell script file for adding the ignore and another 1 of each to remove the ignore, if you wish.

If you are comfortable using regedit, you could forego creating the registry files in favour of manually creating the keys and values, but I'll leave that up to you.

 

  • You may change the key names in the registry to whatever you wish, I just used dropbox_ignore and dropbox_stop_ignoring for the sake of simplicity, you may also change the text displayed in the context menu if you like.
  • The ampersand (&) is used to define a mnenomic key which can be used to select the command quickly with the keyboard, in this case I have elected to use "d" for both but you may change it, just move the ampersand to just before whichever letter you wish you use as the mnenomic.
  • I suggest leaving the path to powershell.exe as is, I have powershell 7 installed and I did try to direct it to that instead initially but it refused to work, whereas just using the 1.0 powershell seems to work fine, I'm not sure why but if it ain't broke don't fix it, I suppose.

Yes, all those backslash characters (\) are necessary, and if you change the path to your powershell scripts, be sure to put two backslashes to represent a directory separator as it must be "escaped" (the backslash character is used to tell the system that the character following it is a literal character and not an escape character, so we have to use two there, and four in the actual powershell path).

 

To use these, simply create the files as shown below and then run the .reg files to insert the values into the registry, or create the keys and values manually if you prefer. Once you've done that, the commands should show up in your explorer shell context menus when you right click upon a folder. In Windows 11, you will likely have to choose the "Show More Options" menu item at the bottom of the context menu in order to see the new commands.

 

Registry File: dropbox ignore command.reg

 

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\dropbox_ignore]
@="&Dropbox Ignore"

[HKEY_CLASSES_ROOT\Directory\shell\dropbox_ignore\command]
@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -File \"C:\\powershell scripts\\dropbox\\dropboxignore.ps1\" \"%L\""

 

 

Powershell Script: dropboxignore.ps1

 

$path = $args[0]

Set-Content -Path $path -Stream com.dropbox.ignored -Value 1

 

 

Registry File: dropbox stop ignore command.reg

 

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\dropbox_stop_ignoring]
@="&Dropbox Stop Ignoring"

[HKEY_CLASSES_ROOT\Directory\shell\dropbox_stop_ignoring\command]
@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -File \"C:\\powershell scripts\\dropbox\\dropboxignore-remove.ps1\" \"%L\""

 

 

Powershell Script: dropboxignore-remove.ps1

 

$path = $args[0]

Clear-Content -Path $path -Stream com.dropbox.ignored

 

 

I hope this helps some people, until Dropbox finally just adds their own command to the context menu and/or support for ignore files.

Happy syncing!

coder0xff
Explorer | Level 3

For users of Linux, I've made a utility that synchronizes the Dropbox ignore settings to your .gitignore. It's very fast, leveraging the transitive nature of the ignore attribute. https://gist.github.com/coder0xff/ca41728fd55b0f74dd970ff46972cdbb

Steve A.13
Helpful | Level 7

Are there "Dropbox ignore settings"? Only on Linux?

 

Synching Dropbox ignore settings to .gitignore would be nice, but I'd be thrilled to have any way to have Dropbox ignore specify files or file types.

coder0xff
Explorer | Level 3

The settings I'm referring to are the com.dropbox.ignored extended attribute that can be set on a per-file and per-directory basis. They can be set manually using the attr command. My script automates setting or clearing the attribute based on .gitignore. See https://help.dropbox.com/sync/ignored-files

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    coder0xff Explorer | Level 3
  • User avatar
    Steve A.13 Helpful | Level 7
  • User avatar
    Bloodreaver New member | Level 2
  • User avatar
    Darcey Explorer | Level 4
What do Dropbox user levels mean?