28

I am trying to sync a code project between two computers, one running Windows and the other running Ubuntu 12.04. I use Eclipse on both machines, but the .metadata folder produced by Eclipse is causing Eclipse to crash because of OS incompatibilities.

I was wondering if there is a way to tell Dropbox to "ignore this folder" or something like that. Or maybe have it ignore all hidden files.

user2428118
  • 7,935
  • 4
  • 45
  • 72
tyler
  • 589
  • 2
  • 5
  • 9
  • 1
    The content of the .metadata folder is not meant to be shared, independent of platform incompatibilities. Please get a reading on version control systems. Your question is about hiding the symptomes, not about fixing the root cause. – Bananeweizen Aug 25 '12 at 10:50
  • 5
    Dropbox really needs to just add some sort of `.ignore` file. At the end of the day it will save their servers a lot of work not having to sync my `bin` and `obj` folders every time I build my projects. – Zapnologica Nov 23 '16 at 11:08

5 Answers5

25

Using the Official Dropbox Command Line Interface (CLI)

PROMPT$ dropbox help exclude
dropbox exclude [list]
dropbox exclude add [DIRECTORY] [DIRECTORY] ...
dropbox exclude remove [DIRECTORY] [DIRECTORY] ...

"list" prints a list of directories currently excluded from syncing.
"add" adds one or more directories to the exclusion list, then resynchronizes Dropbox.
"remove" removes one or more directories from the exclusion list, then resynchronizes Dropbox.
With no arguments, executes "list".
Any specified path must be within Dropbox.

http://www.dropboxwiki.com/tips-and-tricks/using-the-official-dropbox-command-line-interface-cli

  • This require to have the client running, is there a solution without this restriction ? – Dimitri Kopriwa Dec 30 '15 at 17:12
  • I think it's worth noting that, on Linux at least, `dropbox exclude` allows you to exclude _files_ (per the wording, if not the intent, of this question) as well as folders. The GUI only lets you exclude folders. – Paul Bissex May 12 '19 at 17:45
  • What CLI version did this work with? It doesn't appear to be an option on 3.0 – John R Perry Jul 27 '19 at 06:56
  • The author of that site deleted its contents, so here's an archive link: https://web.archive.org/web/20190219090359/http://www.dropboxwiki.com/tips-and-tricks/using-the-official-dropbox-command-line-interface-cli – xamid Jan 04 '21 at 11:00
  • When I exclude a file, i.e. `dropbox exclude full_file_path` and then check the list with `dropbox exclude` it says "No directories are being ignored.". Are others finding the same? Is it excluding the file anyway? (Hard for me to test at the moment because I am exceeding dropbox space by a lot currently.) – Kvothe Jan 25 '21 at 17:30
  • Also this answer should emphasize what exclude does which seems to be prevent downloading from the cloud instead of preventing uploading from the local copy as the OP (at least in the title) asks for. (And I imagine that most people coming here search for the same which is a functionality that dropbox calls "ignoring".) https://help.dropbox.com/files-folders/restore-delete/ignored-files – Kvothe Jan 25 '21 at 17:55
18

Right click on the taskbar icon, select preferences, then the advanced tab and set up selective sync. Enabling advanced view will help, too.
In general, you should consider using a version control system like Subversion, Mercurial or git. You can make use of free hosting services (Assembla, Github, Bitbucket just to name a few) or set up a repository on a USB drive (works very well for personal projects).

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
f4lco
  • 3,728
  • 5
  • 28
  • 53
  • Thanks for the help! I do use git for my personal projects, but I am wanting to use dropbox for this specifically because it is for homework projects for school. If i used a public hosting site like github I could get in trouble for distributing homework. – tyler Aug 26 '12 at 19:08
  • 6
    Use bitbucket.org, which gives you unlimited private repos (with a max of 7 other people using any of your free repos). – Malcolm Jun 21 '13 at 03:12
  • 1
    @Malcolm Also, sites like [GitHub](https://education.github.com/pack/offers) and [Bitbucket](https://blog.bitbucket.org/2012/08/20/bitbucket-academic/) have educational programs where you can get private repositories and more for free if you have an educational e-mail address. – user2428118 Dec 16 '14 at 02:36
15

If you're checking this in or after 2020, you can follow the official way to ignore a file/folder from syncing to dropbox from your computer.

Although, at the time of writing this post, the feature is still in Beta.

https://help.dropbox.com/files-folders/restore-delete/ignored-files

ignoring is different from excluding.

  • Dropbox exclude removes the folder from your machine altogether. The file/folder does, however, stay on Dropbox's servers. Excluded folders can be included back onto your machine whenever you choose by going to the dropbox app's settings.
  • ignore lets you keep the file or folder on your machine but doesn't sync the file or folder to Dropbox at all. That means the folder only lies on your current machine and not on Dropbox.

For example:

  1. You would choose dropbox exclude to exclude a big backup file that you don't have space for or don't need on your machine. The file/folder will still exist on Dropbox.

  2. You would choose to ignore folders from syncing to dropbox when your folder contains thousands or millions of temporary files that aren't necessary to be backed up. Backing up such a folder could cause Dropbox to use a lot of CPU cycles and RAM on your computer to keep track of all the changes to your files. This might slow down your computer.

    • An example of such a folder is node_modules which get installed in a node project directory. node_modules have quite a number of files within them which can be safely ignored from syncing to Dropbox and recreated by doing a npm install at any point in time.

    • You might also choose to ignore environment variable files containing secret keys to your web server or your ssh private keys. This could be useful while sharing folders across teams on Dropbox.

How to Exclude: - To exclude a file from syncing from dropbox to your computer, you would need to either:

  • All platforms: Change the folders to sync in the selective sync settings in the Dropbox app.
  • Linux Dropbox CLI: Or run the command dropbox exclude add "FULL_PATH_TO_FILE_OR_FOLDER_TO_EXCLUDE" in your terminal.

How to Ignore

To ignore a file from getting synced from your computer to Dropbox, you'd need to run the following commands in the terminal while changing the FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX in the commands below to the file/folder you need to exclude:

Mac:

  1. alias dropboxignore="xattr -w com.dropbox.ignored 1"
  2. dropboxignore "FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX"

Linux:

  1. alias dropboxignore="attr -s com.dropbox.ignored -V 1"
  2. dropboxignore "FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX"

Windows - Powershell:

Set-Content -Path "FULL_OR_RELATIVE_PATH_TO_FILE_IN_DROPBOX"
    -Stream com.dropbox.ignored -Value 1
JG in SD
  • 5,427
  • 3
  • 34
  • 46
BoreBoar
  • 2,619
  • 4
  • 24
  • 39
  • this is the only answer that works for me! after updating dropbox client, the "exclude" method doesn't work any more which automatically renames folders with "(Selective Sync Conflict)". – bumfo Dec 31 '19 at 17:33
  • What version of the Dropbox client does this feature start with? – kristianp Jan 01 '20 at 20:59
  • 1
    I'm unsure of the version number it starts with. But the current builds of Dropbox does support it. Also, the `dropbox exclude` command is for the Linux Dropbox CLI only. So `dropbox exclude` won't work for Windows or Mac from the command line. But one can use Dropbox App's setting to exclude files from syncing to your computer. Ignoring works on all 3 platforms with the commands provided. On Windows, it needs to be run within Powershell. – BoreBoar Jan 02 '20 at 10:50
  • 1
    I can't get this to work with Powershell on Windows 7. I get this error message: PS> Set-Content -Path .\Logs -Stream com.dropbox.ignored -Value 1 Set-Content : A parameter cannot be found that matches parameter name 'Stream'. At line:1 char:33 + Set-Content -Path .\Logs -Stream <<<< com.dropbox.ignored -Value 1 + CategoryInfo : InvalidArgument: (:) [Set-Content], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetContentCommand The same error for a single file or a folder. – Kevin P. Jun 14 '20 at 17:30
  • Dropbox help article (which does not work with Windows 7): https://help.dropbox.com/files-folders/restore-delete/ignored-files – Kevin P. Jun 14 '20 at 18:00
  • 1
    Thank you for this detailed answer. I've recently implemented [dropboxignore](https://github.com/sp1thas/dropboxignore) which is a simple shell script which facilitates you to generate `.dropboxignore` files based on your file patterns or even based on existing `.gitignore` files and ignore matched files from dropbox. Hope to find it useful. Any feedback is more than welcome. – Panagiotis Simakis Dec 28 '20 at 08:48
  • As already stated by @KevinP. this doesn't seem to work on Windows 7. – xamid Jan 04 '21 at 11:29
  • Is this still up to date? Do you have any reference on this. From the documentation on https://help.dropbox.com/installs-integrations/desktop/linux-commands I would think that `exclude` does what you say `ignore` does. And `ignore` does not seem to exist at all anymore. Am I misunderstanding it? – Kvothe Jan 25 '21 at 17:27
  • Okay my bad. Seems I misread the very confusing dropbox documentation. See also this reference https://help.dropbox.com/files-folders/restore-delete/ignored-files on "ignoring" which is what the OP (at least in the title) and probably most people want. After ignoring many files my used dropbox space on the cloud has not gone down. Do I need to do something to refresh dropbox and make it delete the ignored files from the cloud? – Kvothe Jan 25 '21 at 17:52
  • Ideally, you should ignore your files before they get backed up. If they've already been backed up, you'd need to delete them from your dropbox and then run the ignore script. – BoreBoar Jan 26 '21 at 08:25
5

You can name the file in such a way that Dropbox considers it a temporary file, which will prevent it syncing.

eg. .~myfile.foo

According to their help: https://www.dropbox.com/en/help/145 -

Temporary files

When some applications (such as Microsoft Word, Excel, or PowerPoint) open a file, they will often save a temporary file in the same directory and name it in one of the following ways:

Name begins with ~$ (a tilde and dollar sign) or .~ (a period and tilde)

  • Name begins with a tilde and ends in .tmp, such as ~myfile.tmp
  • Dropbox does not sync these temporary files on any operating system.
Community
  • 1
  • 1
Jim Morrison
  • 2,077
  • 1
  • 19
  • 27
  • so what would the specific suggestions be regarding the "._*" files the author described here? I also noticed it says such "Metadata and resource forks" will be ignored purposefully, but it's actually not. – scotty Dec 29 '17 at 01:38
1

Here is a script that will sync dropbox ignore with .gitignore in current folder and subfolders on Windows using Powershell. It requires the git command line to be installed.

Get-ChildItem -Recurse | `
Where-Object { $_.Name -eq '.gitignore' } | `
ForEach-Object { `
    Write-Host $_.DirectoryName; `
    Push-Location $_.DirectoryName; `
    git status --ignored --short | `
      Where-Object { $_.StartsWith('!! ') } | `
      ForEach-Object { `
          $ignore = $_.Split(' ')[1].Trim('/'); `
          Write-Host $ignore; `
          Set-Content -Path $ignore -Stream com.dropbox.ignored -Value 1 `
      }; `
    Pop-Location `
 }