How to exclude files (not folders) from dropbox sync?

109

34

I am trying to sync my Firefox profile folder using Dropbox, but there are several files that Firefox changes quite frequently

  1. Folders: Cache, OfflineCache can be excluded
  2. Files: urlclassifier3.sqlite, places.sqlite - these files are big and are changed anytime

OS: Windows 7

Does anyone know how to exclude files listed in #2 from Dropbox sync?

Jun Jing Zhang

Posted 2012-01-09T09:37:27.037

Reputation:

@AshutoshJindal While the bandwidth isn't that great I get annoyed every time I edit a word document in a synched folder and the ~ file gets synched and then deleted. – Loren Pechtel – 2015-04-03T22:55:53.310

Dropbox provides this feature: https://help.dropbox.com/files-folders/restore-delete/ignored-files

– Caesar – 2020-02-28T03:43:34.247

1Selective sync? – Alex – 2012-01-09T09:39:37.697

Bookmark Backup Firefox addon copies the bookmarks file to a directory of your choice every time you close Firefox. You can point it to your Dropbox folder. Another option is to use Windows Robocopy + taskschd to do the same thing. To copy places.sqlite every 60 minutes you can use something like this: robocopy C:\Users\Someone\AppData\Roaming\Mozilla\Firefox\Profiles\default C:\Users\Someone\dropbox\apps\firefox\ places.sqlite /MOT:60 – You can schedule it to start with windows so you will not have to rerun every boot. – ramiwi – 2013-11-10T17:13:02.833

You may not need to worry about big files being synced. Dropbox does not sync the whole file only the portion that changed. Look at http://serverfault.com/questions/52861/how-does-dropbox-version-upload-large-files. In practice, I have seen this happen on a number of big files which are changed frequently.

– Ashutosh Jindal – 2014-01-30T17:46:15.943

1

Wouldn't it be better to use Firefox's built-in sync function, rather than causing potential problems by using dropbox? Also, do you really want to give all your browsing history to Condoleeza Rice?

– stib – 2014-06-06T06:47:51.240

Answers

76

To exclude FILES, not folders, from Dropbox, there is a trick you can do:

  1. Move the file somewhere else

  2. Create a folder with the same name in place of the file

  3. Go to Dropbox selective sync options and ignore the folder, this will also delete it

  4. Move the file back in place

Example

How to ignore single file in Dropbox

Enjoy your ignored file!

Zequez

Posted 2012-01-09T09:37:27.037

Reputation: 1 564

this is the way to go! – duedl0r – 2014-07-08T09:03:21.967

Thanks for the workaround. Why doesn't dropbox allow this natively!? I'd love to be able to exclude files/folders based on regex, but maybe that's too geeky for such a commercial product. – bradvido – 2014-08-12T13:06:59.520

190I would rather have a .dropboxignore file :P – Zequez – 2014-08-13T13:15:26.977

For those who may not be aware, you will need to set the selective sync setting on each device. At least that was my experience. Nice work-around though – Brettski – 2014-10-18T16:22:53.507

Yeah, it certainly should be included. – Loren Pechtel – 2015-04-03T22:54:17.880

5

@Zequez - There's a request for that: https://www.dropboxforum.com/hc/communities/public/questions/201289669-Ignore-folder-without-selective-sync-

– Asaf – 2015-06-30T14:14:25.100

1Great, works for me. Anyone up for automating that for several files? I tried to find where Dropbox stores that info, but no success yet. It seems Dropbox stores all its data here, but in a format that's unknown to me: %USERPROFILE%\AppData\Roaming\Dropbox\instance1 – AronVanAmmers – 2015-09-29T22:21:51.447

This has made a HUGE difference in my life! I want to buy something from your wishlist or something OMG you have no idea thank you so much! – rlpowell – 2016-08-14T02:15:43.660

7'.dropboxignore' file would be amazing. It would also save thier servers a huge load. We store development project solutions on dropbox. Every time I build by project DB then goes and syncs 2000 tiny files. – Zapnologica – 2016-10-26T05:27:06.983

1Yeah, it's ridiculous that they still haven't added or even commented on the issue. A lot of other syncing services have this feature. Personally, I made a switch to BTSync+Amazon EC2 this year which works like a charm after the initial server configuration. – Zequez – 2016-11-17T23:43:02.530

5

This is so good I had to add gif :)

– Vlastimil Ovčáčík – 2017-01-20T10:42:33.520

Thank you very much. I've got a folder dropbox and onedrive share, and the ".hexhexhex" file onedrive creates drives dropbox crazy – Peter Berbec – 2018-02-13T00:49:37.540

Thank you Zequez! You just saved my sanity, trying to get Lightroom working inside Dropbox :) – maxigs – 2018-05-26T22:26:29.697

That gif was so slow it was almost a jpg – John R Perry – 2019-07-27T06:58:50.100

i think maybe this doesn't work any longer; i see a behavior aligned with what is described here: https://help.dropbox.com/installs-integrations/sync-uploads/selective-sync-conflict

– RH Becker – 2019-11-07T01:44:31.253

55

On Linux, you can use the dropbox command line tool that comes with Dropbox:

$ dropbox filestatus
PV_2013.aux:                      up to date
PV_2013.log:                      up to date
PV_2013.pdf:                      up to date
PV_2013.tex:                      up to date    

$ dropbox exclude add *.log *.aux
Excluded: 
../ag_2013/pv_2013.aux
../ag_2013/pv_2013.log

$ dropbox filestatus
PV_2013.pdf:                      up to date
PV_2013.tex:                      up to date    

ℝaphink

Posted 2012-01-09T09:37:27.037

Reputation: 3 531

3That is really cool! Too bad it doesn't work on other platforms. Just tried it with the executable on OSX but that fails... – Tieme – 2015-12-20T09:43:16.773

7As a clarification, this appears to only exclude specific individual files matching the wildcard pattern. You can't use this to e.g. prevent and files ending in .log from syncing. – Shimon Rura – 2016-02-06T23:49:53.787

1@ShimonRura What do you mean? – JAB – 2016-09-22T16:47:25.947

3@JAB I mean that when you issue the dropbox exclude command, any wildcards used in parameters are evaluated (by your shell), and the matching filenames are excluded by dropbox. Dropbox doesn't interpret the excluded file paths as patterns, even if your shell passes through a string with an asterisk in it. So excluding *.log won't prevent a file called foo.log from syncing, it will only exclude a file literally called *.log. – Shimon Rura – 2016-09-23T16:33:59.087

3@ShimonRura Oh right, shell expands before execution. I see what you mean now. That's more limiting, but makes sense. So there's no actual wildcard support within dropbox exclude itself. – JAB – 2016-09-23T17:47:16.263

There's difference in *.MP4 and *.mp4. Be careful ! – Alan CN – 2017-05-17T16:40:03.190

You need to rerun the command every time you add a new file you wish excluded, because the wildcard only apply at the time of exclusion, as ShimonRura explained. – apraetor – 2018-01-24T20:55:25.543

Which program are you using to sync Firefox files to dropbox folder? You would have to filter it with that sync program. – Jon Grah – 2018-05-20T14:33:34.243

8

In Dropbox Settings, go to Advanced > Selective Sync. If you see an Advanced View or similar button, click it. Uncheck the cache folders and any other folders you find Firefox is changing frequently.

I did this with my Chrome installation and the above steps helped me shave off the syncing of huge caches, icons, etc.

As for any files you don't want synced but you find are inside folders that you do want synced, exit Firefox, move the file to another location, then create a symbolic or hard-link to it in the original location. When Firefox is run again, it will see the file as though it was never moved, but Dropbox will see the link and not sync the actual file.

Apparently Dropbox does sync symbolic links or hard links as though they are actual files.

But if you know for sure what files in a folder you want synced (that is, their names are fixed, not changing or random), you can do a reverse-syncing hack:

  • In Selective Sync feature, exclude the entire folder containing both the files you don't want synced and those you do want synced.
  • Create a new folder next to the excluded folder. This folder will be synced by Dropbox. You may name it suitably to indicate that it is a duplicate of the excluded folder.
  • In the new folder, create hard links (or symbolic links) to the files in the original excluded folder that you do want to be synced.

Dropbox will sync these files as though they are residing in this new folder, eventhough they are actually in the original one. In addition, Dropbox will not sync files that you did not create links to.

ADTC

Posted 2012-01-09T09:37:27.037

Reputation: 2 649

Then I can only think of a reverse-hack. Exclude that entire folder, but create a duplicate folder, then hard-link (or symlink) all the files you do want to be synced in that folder. So that essentially, all the files you did not link to will not be synced because the original folder is now excluded. Of course this assumes the file names are fixed, not random. – ADTC – 2013-11-10T19:28:10.933

Well, I can see how this is going to work for a small set of files, but I'm sure Firefox will create files during usage that could be needed. Somebody needs to test this, I guess. – slhck – 2013-11-10T19:39:53.593

Yes, it will only work seamlessly with a known set of files. – ADTC – 2013-11-11T03:28:49.277

4

Since Dropbox staff made it clear that it will NOT implement a selective file/folder sync, the user will have to implement this manually. Instead of using symbolic link, you can use a program like FreeFileSync and customize exactly which files you want synced and to which folder[x].

You can either use realtimesync or windows task scheduler to have granular control over how often the files are synced.

Or if you want compression/encryption of your files, then you can use cryptsync.


I do understand that for those that have large files elsewhere on their system and do not want to duplicate them into a separate folder (and thus use symbolic links) this is not an ideal situation. If there was a way to schedule how often to apply the syslink, maybe that would be a compromise. For example, setup a windows task to add symlink, wait xx minutes for dropbox sync to complete, then another task to delete/undo the symlink to prevent unwanted auto-syncing by dropbox.


Here is a photo showing dropbox staff confirming after >3 years of multiple request, they will not be adding the feature:

dropbox says no selective file syncing for you

^I don't know how to make the image a thumbnail or smaller so that users can click on it and make it larger in a separate lightbox, sorry.

Jon Grah

Posted 2012-01-09T09:37:27.037

Reputation: 346

2

You cant exclude files from dropbox sync , but you can delete them or change those files location.

Using DropBox for Firefox sync may result in conflict of profile, better use FireFox built in Sync tab under option or settings

Kishore Jangid

Posted 2012-01-09T09:37:27.037

Reputation: 363

Thanks. But the firefox built in sync can't handle the extensions part. – None – 2012-01-09T12:46:54.717

1just see the updated firefox it has option to syn extension too.. voteup or accept if it helps you – Kishore Jangid – 2012-01-09T13:35:10.137

1

It actually is available now, currently in beta, may not work for all users.

Mac:

xattr -w com.dropbox.ignored 1 <absolute dir/filepath>

Linux

attr -s com.dropbox.ignored -V 1 <absolute dir/filepath>

Windows

Set-Content -Path <absolute path>  -Stream com.dropbox.ignored -Value 1

let's hope they add the GUI part in the near future.

source

Martin.

Posted 2012-01-09T09:37:27.037

Reputation: 153

If I don't set the same on other machines, it will turn into a Sync Conflict and download the folder from the other machine. But great, that they're finally doing it ;-) – TobiO – 2020-02-26T13:56:19.493

1

[NOTE: This NO LONGER WORKS WELL AND IS DISCOURAGED by DropBox and by me based on my own personal experiences with symlinks causing high CPU usage of the Dropbox app. I'm leaving the answer here for posterity and a warning to others. No need to downvote (ahem)]

I'm not sure what OS you're using or how Firefox in particular would react to this but whenever I need to exclude files from Dropbox (which cannot simply be deleted or moved for whatever reason), I simply move the file outside of the Dropbox folder and then create a symlink in the old location pointing to the new one.

Dropbox sync the link as a symbolic link but knows/cares nothing about the underlying content.

Jay Allen

Posted 2012-01-09T09:37:27.037

Reputation: 285

11On both Linux and Windows, symlinked folders or files are synchronized just like regular files (i.e. the symlink's target is copied, not the symlink itself), so this workaround doesn't seem to work any more. Tested with Dropbox 2.0.22 on W7 and 2.0.26 on Linux. – Lebenita – 2013-09-24T09:05:32.487