The search option to include specific directories should be improved

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

The search option to include specific directories should be improved

Post 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)
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

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

Post 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 +++
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
mmm
Member
Member
Posts: 120
Joined: 2020-08-10, 12:32 UTC

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

Post 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.
Post Reply