+1 vote

I don’t know if this is programmatically possible, but is there a way to limit subfolder searches to a specific number of levels?

In my situation I occasionally need to do in depth searches for files that have come in, and I need to do it from a corporate level. The issue is, I have facility specific directories and then archived directories under that. Usually I only need to look at only the facility level, but ‘Subfolders’ option still goes through all the other, deeper directories. Here’s a text representation of what I mean:

\Corporate
     \Facility1
         \2010
              \01
              \02
              \...
              \12
          \2011
              \01
              \02
              \...
              \12
          \2012
              \01
              \02
              \...
              \12

Usually I just go into the Facility1 directory and look there without using ‘Subfolders’, but there are times I need to look at the entire corporation, but I only need to go into the Facility folders, not into the archived ones.

by (30.1k points)

1 Answer

0 votes
 
Best answer

You have two options I can think of:

1 - Limit depth using Location Filters

Using a Location Filter you can limit the depth based on the number of back slashes in the path, e.g. to only search folders at the second depth we add a regular expression to ignore paths with four or more back slashes, e.g.

Look In: M:\Corporate;-:regex:(.*\\){4,}

So this would search paths with up to three back slashes:

M:\Corporate\Facility1\
M:\Corporate\Facility2\
M:\Corporate\Other\
etc.

but not four back slashes:

M:\Corporate\Facility1\2010\
etc.

2 - Regular expression in Look In field

Alternatively, you could simply search using a regular expression on the Look In field, e.g.

Look In: M:\Corporate\Facility.*

Subfolders: OFF
Expression type: Regular Expression
by (30.1k points)
...