How to avoid full depth searches when searching archives?

Let's say I have a collection of archives and want to find those that contain a specific folder structure, starting from the root:

\folder1\folder2\folder3

How can I prevent Opus from crawling through the entire archive?

Using Full path would require a wildcard because the archive names differ, which extends the folder depth indefinitely.

PathDepth might work if all archives are at the same level in the file system, but it would still feel clumsy.

A special character that identifies the archive's root would be useful for the standard filter.

My attempts with the Evaluator were also unsuccessful, as I couldn’t find a way to determine the archive filename. A function like ArchivePart() or a variable that returns the full path of the archive would be helpful.

Or have I overlooked something?

You could use a full path wildcard like (no match:) *.zip\*\*\*\*

Not perfect, of course, since you have to count the parts instead of adjusting a numeric depth parameter. It could also get confused if by folder names ending in .zip, too. But it may be enough if it doesn't need adjusting often.

Good ideas.

I am mainly concerned about speed, and I meant to explicitly search for folder1\folder2\folder3.

But a wildcard like

type match folders
and fullpath match "D:\\*.rar\\\folder1\\folder2\\folder3"

would already send Opus through the entire archive.

Maybe we need additonal search fields File path and Archive path that work like Full path but are restricted to the respective paths.

Path depth fields for all three paths would be welcome as well, although could probably be provided by the Evaluator.

I think the even bigger problem is that the "Find in" field is not detailed enough and lets Opus enumerate way too many folders.

For instance, if I want it to find my /scripts folder and "Find in" is set to C:\, it will happily search in C:\Program Files etc. even if Full path is set to the full path to /scripts:

fullpath match "^C:\\\\Users\\\\Alexander\\\\AppData\\\\Roaming\\\\GPSoftware\\\\Directory Opus\\\\Script AddIns$" regex
and type match folders

Similarly, set the "Find in" to any other drive and Opus will start looking for this folder that starts with C:.

Want to try it out? Here you go:

Find IN C:\ FILTERDEF fullpath match "^{=Replace(Resolve("/scripts"), "\", "\\\\")=}$" regex and type match folders

So, a way to refine the "Find in" field or connect it with Full path would be very welcome :slight_smile:

You'd need to use subfolder clauses to stop Opus recursing through the whole archive.

(A lot of the time the speed difference won't be large. Most of the time it takes is the time to read the archive's listing into memory, after which testing all the paths inside it against a wildcard will usually be very fast. Unless there are millions of files in the archive, of course.)

If you only want to search within the scripts folder, why start the search at C:\ rather than the scripts folder?

Connecting Find In to the Full Path clause(s) would be very difficult given there could be multiple of them and they might use complex wildcards that have no clear way to tie them back to a starting path.