dropboxignore
dropboxignore copied to clipboard
is ** pattern supported ?
is ** pattern supported (any location) ?
Hello @haoadoresorange
Yep, I just checked this and it seems to work fine:
➜ ~ mkdir tmp-folder
➜ ~ touch tmp-folder/tmp.txt
➜ ~ mkdir tmp-folder/tmp-folder2
➜ ~ tree tmp-folder
tmp-folder
├── tmp-folder2
└── tmp.txt
1 directory, 1 file
➜ ~ echo '**' > tmp-folder/.dropboxignore
➜ ~ cd tmp-folder
➜ tmp-folder tree .
.
├── tmp-folder2
└── tmp.txt
1 directory, 1 file
➜ tmp-folder dropboxignore ignore .
Total number of ignored files: 2
Total number of ignored folders: 2
There is probably and issue on file counting but the files are ignored from dropbox.
Even a 1-level-sub-folder is not working, do you any idea what is the problem ? I might look into that
any news @sp1thas ?
Hello @haoadoresorange ,
you are right, based on current implementation, double asterisks are not supported. On the other hand, a recursive match is enabled by mistakes, therefore, abc
is equal to **/abc
and this is totally wrong. .gitignore
files don't work in this way and .dropboxignore
files should not work in this way too. dropboxignore uses find
to match files, therefore, -max-depth
should be used to prevent recursive matches.
I will start working on this asap in order to fix the wrong recursive matching and to support patterns like **/abc
, abc/**
, etc.
Thanks for your feedback.
So I looked into it a bit and see that we have a very simple solution here:
- instead of using dirname and basename, we use regex to capture it instead in order to conserve the glob pattern (or maybe there is an option for that).
- now if the dirname part contains any glob pattern AND not for the file in current dir (because
find ./*.extension
doesn't work), we directly usefind
for the whole path asfind /path/with/glob
withglobstar
option enabled. - otherwise we
find
as normal with-maxdepth 1
.
Tell me if it covers everything, I will make a PR.
@haoadoresorange I totally agree about the second and the third bullet of you comment. It's not really clear to me how we gonna use -regex
. Could you provide an example with find -regex ...
that could be used in our case?
note 1: we must keep the format of .dropboxignore
as similar as posible to .gitignore
format.
note 2: I came across this bash implementation and it seems quite promising (not tested yet).
I just tested it, it isn't working (I think), because of one line that seems pretty weird
xargs -n1 find . -type d -name .git -prune -o -type f -path
overall however, I think the script does what you did in your script already.
the regex can be something simple like this (.*)\/(.+)
EDIT: what I mean by using regex is not to use regex with find
, but to break the path down using regex and then look into the path to decide what to do with it.
EDIT2: once we know what to do with just find
using the path
Hi, this is a really nice utility to have and thank you very much for sharing it !
I can confirm that **
patterns are not picked up, but the search is recursive by default. In addition, I also get an auto-ignore for:
- The folder
.../Dropbox/.dropbox.cache/
-
Vault.dbx-vault
Is this intentional? I don't know what these files and folders do and I am wondering if it is safe to auto-ignore them. If so, it would be nice to have that in the documentation so totally clueless folk like me are not caught unawares!
Thanks @haoadoresorange for your effort, unfortunately I didn't had the time to investigate the case of **
further. I will do my best to explore ways to support **
. My first thought was to find a way to support **
in order to support .gitignore
file patterns directly but this seems to be tricky.
@smalltimer thank you so much for your feedback. dropboxignore should not auto-ignore anything, therefore I would like to ask you to provide a reproducible example of your case. Please provide some the basic folder structure, the current directory, the content of the .dropboxignore
(if exists), the actual command (using --debug
) and the standard output. Given that the this issue is not related to **
I'm encourage you to open a new issue.
Thanks @haoadoresorange for your effort, unfortunately I didn't had the time to investigate the case of
**
further. I will do my best to explore ways to support**
. My first thought was to find a way to support**
in order to support.gitignore
file patterns directly but this seems to be tricky.
Hi actually stopped using dropboxignore a while ago ): I switched to insync which allow an ignore file for dropbox and other services.