Folder filter - expression

Started by Aubrey, January 02, 2017, 02:18:07 PM

Previous topic - Next topic

Aubrey

Preamble:
If I wasn't using IMatch, I would not even think about doing some things... as I know that any other software could not cope (my life could be simpler !!!)

Problem to solve:
I have folders labelled
Processed images\2016\1611 Nov\Hash\2777
Processed images\2016\1611 Nov\Hash\2777\pub\
Processed images\2016\1611 Nov\Hash\2778
Processed images\2016\1611 Nov\Hash\2778\pub\

etc. See attached jpg.

I want to select file folders which ends in pub

In filter expression I have tried
pub\$
pub\\$
But this does not work, suggestions please ...

This is really an intermediate point as I would like to have a data driven category that will automatically pick up all files in folder pub.

(Before IMatch Anywhere this kind of a filter did not enter my thoughts!  ;) ).

Happy new year to all,
Aubrey.

Update:
I have got "pub" working. (see folder.jpg)
But I still cannot get pub\ as the last characters

How can I now select all file folders that fit the criteria. I tried highlighting all and then clicking in box, this does not appear to work.

Aubrey.

PS: Do you want me to send database it is obviously very small?


sinus

Hi Aubrey,

you forgot to attache the image; I think.
Best wishes from Switzerland! :-)
Markus

Aubrey


Mario

\ has a special meaning in regular expressions. It's the escape character. It escapes the meaning of the special character following it. This is surely not want you want.

If you want to find

bla\pub
box\pub

but not

public
pit\pub\bka

use

\\pub$

This means "all folders ending in \pub"

Note the \\ which gives you a literal \  (escaping the escape by doubling it).

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

I've set up a test database with the following:
i.e., I created the directory structure
\Test
\Test\pub\after\AOC_D500_161202_01582.NEF
\Test\Test1\pub\AOC_D500_161202_01583.NEF
\Test\Test2\pub\AOC_D500_161202_01584.NEF

Observations:
New folder
I created a new folder within IMatch
\Test\Test3
This does not show up in Value Filter: 'File Folder'
If I add a file to the folder Test3, then it shows up... is this expected behaviour?
If I move the file in Test3 to another folder (i.e., Test3 is now an empty folder) then Test3 continues to be visible in Value Filter: 'File Folder'

Filter test:
File folder shows
Z:\test\Test1\pub\
Z:\test\Test2\pub\
Z:\test\Test3\
Z:\test\pub\after\

filtering by pub gives: (pub_list.jpg)
Z:\test\Test1\pub\
Z:\test\Test2\pub\
Z:\test\pub\after\

filtering by pub\\$  (pub_list2.jpg)
also \\pub$  (as suggested earlier in thread)
also \\pub\\$

gives empty list

Aubrey.




Mario

Using a value filter on folder is very unusual. Why don't you use the Folder filter instead? The Folder filter is much better.

Closing the filter panel and re-opening it will surely show the new folder. Did you try that?


I most likely did not spend time covering all unusual cases, like users creating a metadata filter on the folter tag, using that in a filter panel and also creating new folders. Sorry, but that would be way too much effort.

What do you mean by filter test? You tested which filter and where?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

Quote from: Mario on January 03, 2017, 12:00:39 PM
Using a value filter on folder is very unusual. Why don't you use the Folder filter instead? The Folder filter is much better.

There are a lot of "pub" folders, I think I have to click on each one, there is no shortcut to select all folders called pub

Quote from: Mario on January 03, 2017, 12:00:39 PM
Closing the filter panel and re-opening it will surely show the new folder. Did you try that?

No I didn't try that

Quote from: Mario on January 03, 2017, 12:00:39 PM
I most likely did not spend time covering all unusual cases, like users creating a metadata filter on the filter tag, using that in a filter panel and also creating new folders. Sorry, but that would be way too much effort.

Makes sense... I think I really need to restructure my file layout... I was already thinking that it was very awkward; in any case I really want to use a data driven category, this was an initial test using static filtering.

Quote from: Mario on January 03, 2017, 12:00:39 PM
What do you mean by filter test? You tested which filter and where?

When I said "filter test". This was application of various filters to see what folders remained after the application of a filter.

The \\pub$ or \\pub\\$  or pub\\$ did not work as expected in this window. There was always a null result.
Filter "pub" gave a result, but it also included "pub\after\" , as it should. In other words trying to get the filter to work on last characters did not work.

Not to worry, I plan to restructure my layout.

Thank you for the quick feedback.

Aubrey.

Mario

Just create a data-driven category on the folder tag.
Use the Filter pattern (under Replace and Filter) with this expression:

pub\\$

This gives you a data-driven category with all folders ending with pub\ 

which is what the folder tag contains. It always ends in \ you need to consider that in your regexp.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

Quote from: Mario on January 03, 2017, 12:22:00 PM

Use the Filter pattern (under Replace and Filter) with this expression:
pub\\$


That did the trick, thanks.  ;D Now no need to rethink directory structure.

Last evening I had been trying within Basic Settings, category filter without any result. Then playing with "Word boundaries"  :(


Aubrey

The Data driven category works, however there is a folder "other" appearing with some 22,189 entries. See attached jpg showing how Data-Driven Category is set up and the preview.

On opening "other" folder it contains jpgs. However none of the jpgs are in a folder labelled "...\pub\"

If I remove the filter .jpg then there are many more files in "other", my NEFs are also added.

Is there a way to refine the filter so that "other" is not created?

I have used the filter [0-9]\\pub\\$
and also used \\[0-9]{4}\\pub\\$

But the "other" still remains.

Any suggestions?

BTW, for others reading this:
The Wikipedia article: https://en.wikipedia.org/wiki/Regular_expression gives great info on regex syntax. in addition to the URL  http://www.regular-expressions.info/examples.html recommended in the IMatch Help

Mario

I'm sure you have read the help about data-driven categories.
You maybe have overlooked the extra topic on "Other". It explains what "Other" is, whether or not you may need it and how you can easily disable it by setting the Use Other element option to No.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Aubrey

Quote from: Mario on January 04, 2017, 08:55:56 AM
You maybe have overlooked the extra topic on "Other".
:-[ yes I did overlook it.

There is still so much to learn. I really can't imagine how you have thought of so many options, let alone coded them.

Aubrey.

Mario

QuoteThere is still so much to learn. I really can't imagine how you have thought of so many options, let alone coded them.

That's a good question. I gave data-driven (aka 'smart') categories a deep thinkin' and then implemented them as good as I possible could.
And of course some options have been added based on user feedback and wishes.

Looking at some other products and their 'smart' collections always leaves me with the impression that they are not so smart at all  ;)
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook