Code Monkey home page Code Monkey logo

Comments (10)

haoadoreorange avatar haoadoreorange commented on June 11, 2024 2

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.

from dropboxignore.

sp1thas avatar sp1thas commented on June 11, 2024

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.

from dropboxignore.

haoadoreorange avatar haoadoreorange commented on June 11, 2024

image
image
Even a 1-level-sub-folder is not working, do you any idea what is the problem ? I might look into that
image

from dropboxignore.

haoadoreorange avatar haoadoreorange commented on June 11, 2024

any news @sp1thas ?

from dropboxignore.

sp1thas avatar sp1thas commented on June 11, 2024

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.

from dropboxignore.

haoadoreorange avatar haoadoreorange commented on June 11, 2024

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 use find for the whole path as find /path/with/glob with globstar option enabled.
  • otherwise we find as normal with -maxdepth 1.

Tell me if it covers everything, I will make a PR.

from dropboxignore.

sp1thas avatar sp1thas commented on June 11, 2024

@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).

from dropboxignore.

haoadoreorange avatar haoadoreorange commented on June 11, 2024

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

from dropboxignore.

smalltimer avatar smalltimer commented on June 11, 2024

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:

  1. The folder .../Dropbox/.dropbox.cache/
  2. 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!

from dropboxignore.

sp1thas avatar sp1thas commented on June 11, 2024

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.

from dropboxignore.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.