Author Topic: Folder filter - expression  (Read 2039 times)

Aubrey

  • Super Hero
  • ****
  • Posts: 1320
  • IMatch user since June 2008
Folder filter - expression
« on: January 02, 2017, 02:18:07 PM »
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?

« Last Edit: January 03, 2017, 11:19:44 AM by Aubrey »

sinus

  • Global Moderator
  • *****
  • Posts: 4489
  • IMatch-User since 2001 (IMatch 3.6)
Re: Folder filter - expression
« Reply #1 on: January 02, 2017, 02:35:45 PM »
Hi Aubrey,

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

Aubrey

  • Super Hero
  • ****
  • Posts: 1320
  • IMatch user since June 2008
Re: Folder filter - expression
« Reply #2 on: January 02, 2017, 03:44:26 PM »
updated!

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Folder filter - expression
« Reply #3 on: January 02, 2017, 04:48:59 PM »
\ 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).


Aubrey

  • Super Hero
  • ****
  • Posts: 1320
  • IMatch user since June 2008
Re: Folder filter - expression
« Reply #4 on: January 03, 2017, 11:15:46 AM »
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

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Folder filter - expression
« Reply #5 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.

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?

Aubrey

  • Super Hero
  • ****
  • Posts: 1320
  • IMatch user since June 2008
Re: Folder filter - expression
« Reply #6 on: January 03, 2017, 12:17:04 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

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

No I didn't try that

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.

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

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Folder filter - expression
« Reply #7 on: January 03, 2017, 12:22:00 PM »
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.


Aubrey

  • Super Hero
  • ****
  • Posts: 1320
  • IMatch user since June 2008
Re: Folder filter - expression
« Reply #8 on: January 03, 2017, 12:54:17 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

  • Super Hero
  • ****
  • Posts: 1320
  • IMatch user since June 2008
Re: Folder filter - expression
« Reply #9 on: January 04, 2017, 08:24:43 AM »
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

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Folder filter - expression
« Reply #10 on: January 04, 2017, 08:55:56 AM »
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.

Aubrey

  • Super Hero
  • ****
  • Posts: 1320
  • IMatch user since June 2008
Re: Folder filter - expression
« Reply #11 on: January 04, 2017, 12:05:19 PM »
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

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Folder filter - expression
« Reply #12 on: January 04, 2017, 12:55:13 PM »
Quote
There 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  ;)