Search including \subdir\subdir\ not working

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

This should be fixed in 11.50 beta 2, please check!
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search including \subdir\subdir\ not working

Post by *white »

Moderator message from: white » 2024-10-16, 18:42 UTC

ghisler(Author) wrote: 2024-10-16, 13:16 UTC This should be fixed in 11.50 beta 2, please check!
I swapped this post with your post here because it was in the wrong thread.

white wrote: 2024-10-12, 11:51 UTC In Windows Sandbox, I installed Total Commander in the default folder (c:\Program Files\totalcmd\).
I search in "c:\" for the following searches:
...

Code: Select all

"program files\totalcmd\"
The contents of the totalcmd folder is not found.

Code: Select all

totalcmd\
The contents of the totalcmd folder is not found.
Above cases now work.

Earlier you mentioned:
ghisler(Author) wrote: 2024-07-15, 16:42 UTC because it means that TC would have to search trough all subdirectories. For that, the user will have to use:
*.ini \**\usbhub\04*\
That's why I tested:
white wrote: 2024-10-12, 11:51 UTC

Code: Select all

\**\totalcmd\
I don't know if you intended for it to work, but it partially works. But it does not traverse the folder c:\totalcmd if there is one. (BTW there is a bug when using ** in file mask as well.)

This also does not work:

Code: Select all

totalcmd\**\
It seems to do the same as when using \*\ instead of \**\

Since TC 11.50b2, this search means something different:

Code: Select all

\
It used to mean: <empty folder name>\ *
It was a search to only search in the folder at the start and don't traverse in any folder (fast).

But now it means: \*
So now all subfolders are searched which is of course very slow.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

\**\totalcmd\
I don't know if you intended for it to work, but it partially works. But it does not traverse the folder c:\totalcmd if there is one.
\**\ stands for one or more folders, so it will not find c:\totalcmd when starting in c:\, but it will find "c:\Program Files\Totalcmd" and also "c:\Program Files\GhislerTotalcmd". If you want to find totalcmd anywhere, use
totalcmd\
instead.
totalcmd\**\
This isn't currently supported, so it does what you say (find only \*\). I will try to add it
It used to mean: <empty folder name>\ *
It still does, but TC starts searching subdirs only for no reason (but doesn't find anything extra). I will fix it.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search including \subdir\subdir\ not working

Post by *white »

ghisler(Author) wrote: 2024-10-17, 07:56 UTC \**\ stands for one or more folders
That doesn't make sense, the purpose of a variable number of nested subfolders is that it is variable, not that it has a minimum number. It is not intuitive and you make it very hard if \**\ in the middle or at the end, for example: subdir\**\totalcmd\
See also this post.
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search including \subdir\subdir\ not working

Post by *white »

HISTORY.TXT wrote: 22.10.24 Added: Find files: *.ext | \ will find files with extension ".ext" in subdirectories but not the base directory of the search (32/64)
..
17.10.24 Fixed: Find files: \**\ at the end of a search string was interpreted as \*\ (exactly one directory) (32/64)
17.10.24 Fixed: Find files: \**\ in the middle of a search string was sometimes treated as 0 or more directories, sometimes as 1 or more. Now it's always 0 or more (32/64)
17.10.24 Fixed: Find files: Ignore/Remove \**\ or **\ at the start if a search name, searching for \**\dir\*.ext is the same as dir\*.ext (32/64)
17.10.24 Fixed: Find files: when searching for a single backslash \ (meaning limit to current directory) we don't need to search all subdirectories (32/64)
Tested OK using TC 11.50b3 32-bit and 64-bit. I wasn't able to find something that didn't work.

So using traverse filters is implemented such that subfolders are traversed into if they match a traverse filter, but when a match is encountered the folder is traversed into but not its subfolders. If you want to include subfolders as well you will have to add **\

Example:

Find all files/folders in folders named "totalcmd"

Code: Select all

Search for: totalcmd\ | \
Search in: c:\
Find all files/folders in folders named "totalcmd" and include all the subfolders

Code: Select all

Search for: totalcmd\**\ | \
Search in: c:\
Without using traverse filters (slower):

Code: Select all

Search for: totalcmd\*
Search in: c:\

Code: Select all

Search for: totalcmd\**\*
Search in: c:\

It should be added to the help page "Find files: General" that \**\ in a path means zero or more subfolders.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

What would you think about the following help text?
\**\ can be used to find 0 or more directories, e.g. \subdir1\**\subdir2\
End the path with \**\ to also find files in subdirectories, e.g. \subdir1\subdir2\**\
I would add this below the text
1. Relative to the search start directory: \subdir1\ or \subdir1\subdir2\ or \
2. Relative to any subdirectory: subdir1\ or subdir1\subdir2\ (no backslash at the start)
on the page Find file - General.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search including \subdir\subdir\ not working

Post by *white »

How about adding the info about \**\ to the info about wildcards at the beginning, for example like this:
In this field, you can enter the search mask for the files you want to find. A question mark ? stands for exactly one character, and an asterisk * stands for any number of characters. The special wildcard \**\ can be used in paths and stands for any number of subfolders.
And add 2 examples to the list of examples, for example like this:
Examples:
*.ini finds for example win.ini
Smith finds "Letter to Mr. Smith.doc"
*.bak *.sik *.old finds all backup files with these extensions
*n.ini finds names which must contain an 'n' in front of the dot.
*wof*.doc finds all names containing "wof" in the name and an extension ".doc".
dir1\**\dir2\*.dll finds dll files only in dir2\, where dir2\ is located within dir1\ at any level
w*.*|*.bak *.old finds files, which start with w and do not end with .bak or .old.
*.ini | windows\ finds all ini files except those in directories called "Windows" and their subdirs.
*.htm? | _vti*\ finds all html files, except in subdirs starting with _vti (used by Frontpage)
windows\ system32\ *.ini finds ini files only in windows\ and system32 dirs
totalcmd\**\ | \ finds all files/folders within total commander directories (including its subdirectories)
Furthermore, I think the text:
To include/exclude certain directories in the search, wildcards can be used in include/exclude directory names, and the names must have a trailing backslash \ . Directories can be found anywhere, or relative to the search start directory:
1. Relative to the search start directory: \subdir1\ or \subdir1\subdir2\ or \
2. Relative to any subdirectory: subdir1\ or subdir1\subdir2\ (no backslash at the start)
might confuse people into thinking that only these directories are searched (and not the directory where the search starts). That's why I started to call them traverse filters in the wiki. This help text might be less confusing in that regard:
To include/exclude certain directories from being traversed into during the search, traverse filters can be included. You do this by including an expression for one or more directory names which must end with a backslash (\). If a filter starts with a backslash, it applies to the search location only, not subfolders. For example:
1. subdir1\ or subdir1\subdir2\ are matched against any subdirectory.
2. \subdir1\ or \subdir1\subdir2\ or \ are matched against the search location only, not its subfolders.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

I agree with most of your suggestions, except for the last one:
To include/exclude certain directories from being traversed into during the search, traverse filters can be included. You do this by including an expression for one or more directory names which must end with a backslash (\). If a filter starts with a backslash, it applies to the search location only, not subfolders. For example:
1. subdir1\ or subdir1\subdir2\ are matched against any subdirectory.
2. \subdir1\ or \subdir1\subdir2\ or \ are matched against the search location only, not its subfolders.
This is also a bit confusing, because the filter isn't actually applied to the search location (e.g. when you start in c:\windows, the search location would be "windows"), but to folders directly within the search location. How about this:
To include/exclude certain directories from being traversed into during the search, traverse filters can be included. You do this by including an expression for one or more directory names which must end with a backslash (\). If a filter starts with a backslash, it applies to subfolders directly in the search location only, not to subfolders of them. For example:
1. subdir1\ or subdir1\subdir2\ are matched against subdirectories anywhere below the search location.
2. \subdir1\ or \subdir1\subdir2\ or \ are matched against subdirectories directly in the search location only, not in its subfolders.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search including \subdir\subdir\ not working

Post by *white »

ghisler(Author) wrote: 2024-10-28, 08:29 UTC This is also a bit confusing, because the filter isn't actually applied to the search location (e.g. when you start in c:\windows, the search location would be "windows"), but to folders directly within the search location. How about this:
To include/exclude certain directories from being traversed into during the search, traverse filters can be included. You do this by including an expression for one or more directory names which must end with a backslash (\). If a filter starts with a backslash, it applies to subfolders directly in the search location only, not to subfolders of them. For example:
1. subdir1\ or subdir1\subdir2\ are matched against subdirectories anywhere below the search location.
2. \subdir1\ or \subdir1\subdir2\ or \ are matched against subdirectories directly in the search location only, not in its subfolders.
Agreed. Except be consistent in using either using "folders" or directories". I tried to be consistent with the current help text and meant to use directories everywhere, but I slipped up and used both terms. And now you do too :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

Folders is the umbrella term for both directories and virtual folders. It's not wrong to write about subfolders here, although the search can't handle virtual folders. But it may be better to make it consistent.
Author of Total Commander
https://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

Please check the help changes in beta 4.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search including \subdir\subdir\ not working

Post by *white »

ghisler(Author) wrote: 2024-10-31, 10:05 UTC Please check the help changes in beta 4.
I have checked. Changes are OK, except for the following:

I seem to have added:
\**\ can be used to find 0 or more directories, e.g. \subdir1\**\subdir2\
End the path with \**\ to also find files in subdirectories, e.g. \subdir1\subdir2\**\
My idea was to state at the beginning that you can use \**\ anywhere in paths, which you did now, and provide a few examples to provide further clarity, which you also did. That way we can keep the explanation simply and focused on its basic function. So I think you should leave this text out. What you are trying to convey here, is explained already.

Also, the next line:
If you exclude a directory, all its subdirectories will be excluded too.
should be removed now. There is no need anymore to explain that all subdirectories are excluded too, because we explained the feature now in terms of traversing through directories. It's now already obvious that when a directory is not traversed into that all subdirectories are not traversed into as well. Furthermore, using the phrase "exclude a directory" is not clear, that's why described it differently now.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

I agree with leaving out this line:
\**\ can be used to find 0 or more directories, e.g. \subdir1\**\subdir2\
But where is this explained:
End the path with \**\ to also find files in subdirectories, e.g. \subdir1\subdir2\**\
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Search including \subdir\subdir\ not working

Post by *white »

ghisler(Author) wrote: 2024-11-01, 16:27 UTC But where is this explained:
End the path with \**\ to also find files in subdirectories, e.g. \subdir1\subdir2\**\
These lines:
The special wildcard \**\ can be used in paths and stands for any number of subdirectories.

...

totalcmd\**\ | \ finds all files/directories within total commander directories (including its subdirectories), | \ excludes the base directory
But I agree it is useful to let this line in there if you remove the other two lines.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Search including \subdir\subdir\ not working

Post by *ghisler(Author) »

OK, then I will remove just the other two lines.
Author of Total Commander
https://www.ghisler.com
Post Reply