Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

anjanesh's avatar
anjanesh
Helpful | Level 6
6 years ago
Solved

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

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

Replies have been turned off for this discussion
  • anjanesh's avatar
    anjanesh
    Helpful | Level 6
    4 years ago

    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's avatar
    Steve A.13
    Helpful | Level 7
    4 years ago
    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's avatar
    Darcey
    Helpful | Level 5
    4 years ago

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

  • Bloodreaver's avatar
    Bloodreaver
    New member | Level 2
    3 years ago

    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:

     

    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!

  • Steve A.13's avatar
    Steve A.13
    Helpful | Level 7
    2 years ago

    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's avatar
    coder0xff
    Explorer | Level 3
    2 years ago

    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

About 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.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!