Skipping certain subfolders when adding folders to the database

Started by mopperle, February 13, 2025, 02:15:38 PM

Previous topic - Next topic

mopperle

In some situations when adding folders to the database I want to exclude certain subfolders.
They are named like "Analog Neg 12, Analog SW 24" etc. I have added an exception (beside others) under Preferences/Indexing/Skip these folders: \\Analog$; but it doesnt work.
Looking at the help I now see that it says
Quote"With the regular expression \\CaptureOne$ you can instruct IMatch to skip folders ending in CaptureOne"
Means in my case it skips folders ending in "Analog". Is this really correct? Any way to tell IM to skip folders staring with certain characters?


Mario

When you use this regexp: \\Analog$ it will skip only folders named \\Analog, not ending in analog.
The $ means "ending with" but you also demand that there is a \ in front of Analog, so, for example, "\My Analog" will not match.


QuoteAny way to tell IM to skip folders staring with certain characters?

Sure. And much more.

See Regular Expressions in the IMatch help.

^Analog finds all strings starting with the word Analog.
\\^Analog finds all folders with \Analog somewhere.
Etc.

Read the help, use the RegExp Tester app including in IMatch (App Manager) to try your expressions out, then update the folder exclusion.

NOTE: Things twice before you do this. It is generally not a good idea to mix managed (in IMatch) and unmanaged folders. IMatch does not know about the folders, does not track them, may get confusing messages for changes in folders it does not know anything about etc.

The ability to exclude folders was added years ago to handle annoying applications which insist on creating folders with proprietary "config" or "settings" file in every folder the user touches.


mopperle

Thanks Mario, the expression \^Analog did the trick. I'm simply not used to syntax of the Pearl language, more to "standard" things like * as a wildcard in e.g. the MS Windows search.

Mario

Quote from: mopperle on February 13, 2025, 04:11:50 PMThanks Mario, the expression \^Analog did the trick. I'm simply not used to syntax of the Pearl language, more to "standard" things like * as a wildcard in e.g. the MS Windows search.
Regular expressions are universal, with some dialect-specific differences (e.g. Perl vs. JavaScript).

Simple wildcards like * or ? are very limited, regular expressions are way more powerful. And often the only way to do things, e.g. for detecting versions with variations of file names.

They might look a bit strange at first, and people can construct really complex regular expressions to solve specific problems.
For IMatch, simple things like

^ABC (starts with ABC)
ABC$ (ends with ABC)
^ABC$ (exactly ABC)

and some variants which allow for specific numbers or any number of characters and digits following e.g. a file name (for versioning) easy to understand.