The issue is down to how location filters are applied to a search. Filters are applied at the time subfolders are being iterated in the parent folder. Therefore, if folders are specified explicitly they are not subject to the filter.
For example, if you were to search using RegEx on the Look In field:
Look In: C:\usr;-c:\\usr\\tmp
Your results would include all files under the
C:\usr folder except those in the
C:\usr\tmp path. However, if you searched for:
Look In: C:\usr\tmp;-c:\\usr\\tmp
C:\usr\tmp would be included because it was specified explicitly.
Therefore, this is the reason why including
.* in the Look In, e.g.
Look In: C:\usr\.*;-c:\\usr\\tmp
won't exclude the
C:\usr\tmp folder, because it's been, in effect, explicitly specified in the list of folders and is not subject to the filter.
However, having said that I can see that this looks wrong, it's not what you'd naturally expect, so I'll file it as a bug report.
Q. What's the difference between - and ! when excluding folders
A. Any Look In entry prefixed with ! must relate to a specific file or folder (or group of files/folders if using expressions). So if you put
Look In: C:\usr;!InvalidPath
You'll get an error reported in the Summary tab. However a minus prefix is just an expression that is tested against every sub folder found during folder iteration.
Q. What exactly is the expression compared against? e.g., is it always compared against a path that starts with a drive letter?
A. Expressions on Look In folder entries are only matched on the specific folder level. So, with
Look In: C:\.*\temp
.* part just matches against the immediate folders within the root of
C:\. Excluded folders (ie with an '!' exclamation prefix) have the same restriction in that expressions cannot span multiple levels. However, minus and plus filters can be matched on any part of the folder path and are not tied to the start of the path, so,
Look In: C:\usr;-temp
will exclude any folder with temp in the path wherever it is.
Q. How is escaping done, ie why do I sometimes need to escape directory separator
A. As you can hopefully see by now the escaping is not necessary for folder paths as the expression cannot span multiple levels. However, if you use a +/- filter that spans levels then the directory separator will need to be escaped. This is all assuming that you're using RegEx, if you're using Plain Text then no escaping is required.
Q. Do "Look in" and "Persistent Search Filters" only apply to folders and not files
A. Look In folders (including '!' exclusion folders) can specify files but +/- filters can't. The 8.x release cycle will add the ability to specify Persistent File Name filters.
Q. Is there a way to exclude a specific file from a search? For example, there's one huge log file I want to always exclude from my search.
A. Yes, because you know the location of the specific file you can exclude it with a '!' path, e.g.
Look In: C:\usr;!C:\usr\logs\large.log
Note that you can't use an expression for the file name part of the path, e.g. this is not valid
Look In: C:\usr;!C:\usr\logs\.*.log