Page 1 of 1

The search option to include specific directories should be improved

Posted: 2022-09-01, 09:16 UTC
by white
The search option to include/exclude specific directories was added in TC 5.51:
HISTORY.TXT wrote: New in Total Commander 5.51 Final (18.02.03):
...
- New search option to include/exclude specific dirs, e.g. | _vti*\ excludes all dirs starting with "_vti" (search, sync, branch view)
The option to include specific directories has not been very useful and very confusing for a very long time. It's also not consistent with excluding specific directories. My suggestion is to make 2 changes which makes it much more useful and consistent:
  1. If the specified include subdirectory doesn't start with a backslash \, do not try to find a match for this include directory only in the start directory of the search, but also in its subdirectories.
    (When you specify an exclude subdirectory that doesn't start with a backslash, it also excludes subdirectories nested deeper. The same should apply for include subdirectories.)
    So when specified to include subdir1\, include the following subdirectories in the search if they exist:
    • startdir\subdir1\
    • startdir\level 1\subdir1\
    • startdir\level 1\level 2\subdir1\
    • etc.
  2. If a subdirectory is encountered that matches the include directory, include the whole thing. Don't look further inside this directory and include only the subdirectories that match the include directory.
    (The current behavior makes no sense. You already established it should be included, so don't include only a part of it and exclude the rest. When you specify an exclude subdirectory, you also exclude the whole thing when a match is found, not only the part inside of it that matches the exclude directory.)
    So when specified to include \subdir1\, include the following subdirectories in the search:
    • startdir\subdir1\ and all his subdirectories
    And when specified to include subdir1\, include the following subdirectories in the search:
    • startdir\subdir1\ and all his subdirectories
    • startdir\level 1\subdir1\ and all his subdirectories
    • startdir\level 1\level 2\subdir1\ and all his subdirectories
    • etc.
If you make these 2 changes, suddenly it all makes sense. It's consistent with excluding subdirectories and starts to behave like people expect. Specifying search depth becomes also relevant again and including subdir1\subdir2\ can also work.

Describing my suggestion by means of an example:

Search for *.txt in c:\test\ and specify subdir1\ either as include subdirectory or as exclude subdirectory. The search should work like this:
  • Search the directory c:\test (not its subdirectories) for *.txt (unchanged)
  • If subdir1\ is specified as an exclude subdirectory: Search all subdirectories for *.txt, except for subdirectories named "subdir1" (and all its subdirectories) anywhere in the directory tree. (unchanged)
  • If subdir1\ is specified as an include subdirectory: Don't search any subdirectories for *.txt, except for subdirectories named "subdir1" (and all its subdirectories) anywhere in the directory tree. (changed behavior)

Re: The search option to include specific directories should be improved

Posted: 2022-09-01, 22:46 UTC
by petermad
If you make these 2 changes, suddenly it all makes sense. It's consistent with excluding subdirectories and starts to behave like people expect.
I agree. Support +++

Re: The search option to include specific directories should be improved

Posted: 2022-09-02, 05:21 UTC
by mmm
Good job White !

Re 2)
I am not quite sure about
The current behavior makes no sense.

Think twice before removing existing behavior.