DEV Community

Cover image for dropboxignore: it's all about the missing .dropboxignore file
Panagiotis Simakis
Panagiotis Simakis

Posted on

dropboxignore: it's all about the missing .dropboxignore file

The "Problem"

A common issue/request about Dropbox was about ignoring files without using Selective Sync. Dropbox recently introduced the ability to ignore specific files or folders. Although the significance of the new feature, many users [1,2,3,4] have expressed the importance of ignoring files from Dropbox using

In computer programming, glob patterns specify sets of filenames with wildcard characters. For example, the Unix Bash shell command mv *.txt textfiles/ moves all files with names ending in .txt from the current directory to the directory textfiles. Here, * is a wildcard standing for "any string of characters except /" and *.txt is a glob pattern. The other common wildcard is the question mark (?), which stands for one character. For example, mv ?.txt shorttextfiles/ will move all files named with a single character followed by .txt from the current directory to directory shorttextfiles, while ??.txt would match all files whose name consists of 2 characters followed by .txt.

just like .gitignore. For various reasons Dropbox doesn't seems to have the will to implement such feature :/

The walk-around

Alt Text

As a result, I decided to implement

GitHub logo sp1thas / dropboxignore

It's all about the missing .dropboxignore file.

dropboxignore

dropboxignore-logo

It's all about the missing .dropboxignore file.

<a target="_blank" rel="noopener noreferrer" href="https://github.com/sp1thas/dropboxignore/workflows/Testing/badge.svg"><img src="https://github.com/sp1thas/dropboxignore/workflows/Testing/badge.svg" style="max-width: 100%;"></a>
<a target="_blank" rel="noopener noreferrer" href="https://github.com/sp1thas/dropboxignore/workflows/Shellcheck/badge.svg"><img src="https://github.com/sp1thas/dropboxignore/workflows/Shellcheck/badge.svg" style="max-width: 100%;"></a>
<a href="https://dropboxignore.simakis.me/en/latest/?utm=gh" rel="nofollow">
    <img src="https://github.com/sp1thas/dropboxignore/actions/workflows/docs-deployment.yml/badge.svg" alt="Documentation Status" style="max-width: 100%;">
</a>
<a href="https://results.pre-commit.ci/latest/github/sp1thas/dropboxignore/master" rel="nofollow">
    <img src="https://camo.githubusercontent.com/3cafdd2ee5b418cb1b361ec784b0b8a6ce724ea0435cab6678d02ec040d06f14/68747470733a2f2f726573756c74732e7072652d636f6d6d69742e63692f62616467652f6769746875622f737031746861732f64726f70626f7869676e6f72652f6d61737465722e737667" alt="pre-commit.ci status" data-canonical-src="https://results.pre-commit.ci/badge/github/sp1thas/dropboxignore/master.svg" style="max-width: 100%;">
</a>
<a href="https://codecov.io/gh/sp1thas/dropboxignore" rel="nofollow">
<img src="https://camo.githubusercontent.com/2c5240a1e456c27e7d00b37dda02b266e764ab0d945f8ca7140fda00cfb6e7c8/68747470733a2f2f636f6465636f762e696f2f67682f737031746861732f64726f70626f7869676e6f72652f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4c425641383046324456" data-canonical-src="https://codecov.io/gh/sp1thas/dropboxignore/branch/master/graph/badge.svg?token=LBVA80F2DV" style="max-width: 100%;">
</a>
<a href="https://snapcraft.io/dropboxignore" rel="nofollow">
    <img alt="dropboxignore" src="https://camo.githubusercontent.com/226213ae53b361a1de6b1021b5e74a1d772949d3022da2c2a4eba8521a68eb92/68747470733a2f2f736e617063726166742e696f2f64726f70626f7869676e6f72652f62616467652e737667" data-canonical-src="https://snapcraft.io/dropboxignore/badge.svg" style="max-width: 100%;">
</a>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/a809edb0419372e5b894716844775503c12674d10b13d2d716af3d3bd53581c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d676f6f676c652d253233343238354634"><img src="https://camo.githubusercontent.com/a809edb0419372e5b894716844775503c12674d10b13d2d716af3d3bd53581c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d676f6f676c652d253233343238354634" alt="Google code style" data-canonical-src="https://img.shields.io/badge/code%20style-google-%234285F4" style="max-width: 100%;"></a>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/00c8283a194736095c7e6998381c64bc082186d5bab7628500535911b86e702a/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470732533412532462532467261772e67697468756275736572636f6e74656e742e636f6d25324677696b692532467370317468617325324664726f70626f7869676e6f72652532466c617465737425324473746174732e6a736f6e"><img src="https://camo.githubusercontent.com/00c8283a194736095c7e6998381c64bc082186d5bab7628500535911b86e702a/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470732533412532462532467261772e67697468756275736572636f6e74656e742e636f6d25324677696b692532467370317468617325324664726f70626f7869676e6f72652532466c617465737425324473746174732e6a736f6e" alt="Installation counter" data-canonical-src="https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fwiki%2Fsp1thas%2Fdropboxignore%2Flatest%2Dstats.json" style="max-width: 100%;"></a>
Enter fullscreen mode Exit fullscreen mode

InstallationGetting startedCLIHow to Contribute

This CLI shell script aims to take advantage of glob patterns and existing .gitignore files in order to exclude specific folders and files from dropbox sync. The shell script uses this recent approach to ignore folders and files.

Installation

Using the kickstart script

dropboxignore is installed by running one of the following commands in your terminal. You can install this via the command-line with either curl, wget or another similar tool. attr and git should be installed on your system, as well as Homebrew if you are on macOS.

Method Command
curl sudo sh -c "$(curl -fsSL https://rb.gy/g4plll)" c
wget sudo sh -c "$(wget -qO- https://rb.gy/g4plll)" w

Worried about mysterious shorted urls like? Take a look at the installation script here: https://rb.gy/g4plll --> https://raw.githubusercontent.com/sp1thas/dropboxignore/master/src/utils/install.sh)

Snap

Get it from the Snap Store

$ snap install dropboxignore
Enter fullscreen mode Exit fullscreen mode

which is a simple shell script that ignores files from Dropbox based on glob patterns. Additionally, existing .gitignore files can be used to automatically generate .dropboxignore files.

The main difference between dropboxignore and the other relevant projects:

GitHub logo rozbb / DropboxIgnore

An ignore file like .gitignore but for Dropbox

GitHub logo swapagarwal / dropbox_ignore

🔥 .gitignore for Dropbox!

GitHub logo ridvanaltun / dropbox-ignore-anywhere

A tool for help you to ignore files and folders in Dropbox.

GitHub logo MichalKarol / dropboxignore

Tool allowing for watching sync directory and setting Dropbox to ignore paths using .dropboxignore

GitHub logo mweirauch / dropignore

A tool to conveniently ignore files and folders from Dropbox sync.

is the fact that dropboxignore is implemented using shell and the minimum requirements (attr package is the only requirement)

dropboxignore is currently available only for Mac and Linux and has various features:

  • Ignore/Revert specific files
  • Automatically update .dropboxignore
  • Revert all ignored files
  • Updated .dropboxignore based on changes in .gitignore file.

You can find more usage examples [here](https://github.com/sp1thas/dropboxignore#examples]

Things to not expect from dropboxignore:

  1. Automatically ignore new matching files.

When a new file has been created and is matched by a .dropboxignore file, user should re-ignore matching files. A cronjob could solve this drawback.

  1. Automatically detect deletions from .gitignore files

Current implementation can detect and update .dropboxignore file if an extra pattern has been added in the corresponding .gitignores but it can not handle deletions in the same way.

Top comments (3)

Collapse
 
insign profile image
Hélio oliveira

There is a similar project which do the same and use official solution as well and some watchs github.com/mweirauch/dropignore

Thanks for this project, which uses the official way too. That's good.

Collapse
 
sp1thas profile image
Panagiotis Simakis

Thanks for your feedback! dropignore seems quite promising and well structured too. The periodic scanning seems to be a nice approach :D

Collapse
 
lorenzobettini profile image
Lorenzo Bettini

Thank you for this tool!
I'm not sure I understand the aim of .dropboxignore file: it is not monitored and it is not a standard file, is it? Your tool can seem to do without that, can it not?