Reputation: 387
I use dropbox to store all my documents, including my programming projects. The only drawback there is to using it is the fact that it syncs all the useless dependencies. Unfortunately, there is no such things as a .dropboxignore
file. Would it be possible to implement this functionality myself using the .gitignore
file I already have? I want it to be completely automagical.
Thanks
Upvotes: 10
Views: 2421
Reputation: 1257
Dropbox allows you to ignore specific folders or files without excluding them, therefore, you could implement a script that will find files based on your .gitignore
files and ignore them.
I recently implemented dropboxignore which is a simple shell script that creates .dropboxignore
files based on existing .gitignore
files in order to ignore the matched files from dropbox.
Note: dropboxignore is currently available only for Linux and MacOS.
Upvotes: 0
Reputation: 11
This might be useful for others on Windows and Powershell with the git command line tool installed.
The script finds all .gitignore files in current folder and subfolder and sets the ignored files and folders to not upload to Dropbox.
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 }
You can paste this into say dropbox-sync-ignore.ps1
and store in your PATH and run it whenever you start or update a project in git.
Upvotes: 0
Reputation: 4306
There's a great article written by someone who was experiencing similar frustrations with dropbox as you are.
In the article, Peter describes two solutions:
DropboxIgnore - a small bash script which uses the Dropbox CLI to ignore files, only available for Linux.
.dbignore - a .gitignore-like solution, only available for mac OS
Please note that I have not used these products, nor do I have any affiliation with the developers.
Upvotes: 1