What am I doing wrong? I clearly fundamentally misunderstand filtering. via --include --exclude and --filter

what am I doing wrong? I clearly fundamentally misunderstand filtering.

rclone lsl -v --fast-list --filter "+ nore" --filter "- *jpg" --filter "- *.jpeg" --filter "- *" "cachecrypt:"

this should return files containing nore but no jpg or jpeg files and no other files. HOWEVER instead it returns files containing nore INCLUDING jpg files, like it only cares about the first rule.... although if I don't include the "- *" it'll just include all files.

I tried using --include "nore" and --exclude "jpg" but that didn't block jpg files either...

can anyone help me please? what am I doing wrong here? I thought multiple filtering commands were supposed to work? clearly I'm typing something wrong.

  • nore means just a file specifically named 'nore'.

So to match file containing nore, you'd do something like:

        0 2020-06-09 17:25:58.309243487 testnoretest
felix@gemini:~/test$ rclone lsl /home/felix/test --filter '+ *nore*' --filter '- *'
        0 2020-06-09 17:24:26.184510610 nore
        0 2020-06-09 17:25:58.309243487 testnoretest

felix@gemini:~/test$ rclone lsl /home/felix/test --filter '+ nore' --filter '- *'
        0 2020-06-09 17:24:26.184510610 nore

You can put them on a line, but I find that is tough for me to follow personally so I would use filter-from and use a file as it works top down.

If you can explain your logic, I can help you with the filter if you need.

Oh this was a typo ruining the question it was "+ nore"

But also the key question here is how do I use multiple filtering rules and prevent .jpg files from appearing, nothing I've tried works.

edit: no, it wasn't a typo nore just makes italics, which the original message had.

so star nore star is what I typed.

so what I want is any file containing nore, aka star nore star but NO FILES containing jpg or jpeg hence my other filter commands.

The filters execute top down or left to right if you keep them on a line. So you'd want to put your excludes first, includes and finally the last exclude if that was your logic.

https://rclone.org/filtering/#filter-from-read-filtering-patterns-from-a-file gives an example.

rclone lsl -v --fast-list --filter "- *" --filter "+ STARnoreSTAR" --filter "- *.jpg" --filter "- *.jpeg" "cachecrypt:"

That should remove everything, add the star nore star files back in then remove the jpgs? Not entirely sure though.... because when I run this it still doesn't work, it gives me no results at all (whereas before I had dozens of valid ones and 1000s of jpg I didn't want)... plus in all the examples the "- *" always went last.... I think maybe it works reading from right to left not left to right? so really the right answer is:

rclone lsl -v --fast-list --filter "- *.jpg" --filter "- *.jpeg" --filter "+ STARnoreSTAR" --filter "- *" "cachecrypt:"

Yep, tested it, this new command works!

I guess this might be a bug then, if it's supposed to read left to right, it's actually reading right to left.

I assumed it was left to right as I always use the file.

You can use three back tics

like this

to quote a command put the actual command in.

The file is 100% top to bottom as I'm sure of that.

I believe it is actually reading left-to-right and the second command is working as expected. As shown in the examples too, the all exclude line should always come at the last so as to not exclude everything.

It's working this way right now with your working command:

  • Exclude *.jpg
  • Exclude *.jpeg
  • Include *nore*
  • Exclude everything else (i.e *)

For the command, if you had -- * as the first filter, it would exclude everything and not have any results, which is the observed output.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.