rofs-filtered icon indicating copy to clipboard operation
rofs-filtered copied to clipboard

Improving inverted match

Open matteobrusa opened this issue 9 years ago • 5 comments

I'd like to show only .jpg (or .JPG) files in a multilevel directory tree. Unfortunately, from what I understand it's not currently possible to match dirs specifically.

What if dirs were matched with a trailing slash, as in:

# /file1.flac
# /file1.mp3
# /file2.mp3
# /subDir1/                <-- trailing slash
# /subDir1/file3.flac

This way it would be easy to create a regex to match jpgs or folders. What do you think of this?

matteobrusa avatar May 13 '16 12:05 matteobrusa

That's a good idea. You can submit a patch.

gburca avatar May 16 '16 04:05 gburca

to match dirs, I used ^\/subDir1(\/|$) (escaped). This allows to access the dir directly, and sub-elements.

Not sure it is completely correct, but it worked for me.

layus avatar Aug 04 '16 08:08 layus

I believe this ^^ directory-matching technique solves the problem

fulldecent avatar Dec 15 '16 23:12 fulldecent

That works, but it also matches files that are called "subDir1".

gburca avatar Dec 17 '16 04:12 gburca

I've made a patch that appends a slash when matching directories in https://github.com/gburca/rofs-filtered/pull/31. It will however break existing filters, please suggest how to make it backwards-compatible? The other option that would work for me (since I want to allow all directories) is to add DIR to the list of filetypes to match: |type:DIR

kalvdans avatar Nov 20 '18 16:11 kalvdans