solved [TC 10.50] Unexpected search result for list search with wildcards

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

Moderators: white, Hacker, petermad, Stefan2

User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

solved [TC 10.50] Unexpected search result for list search with wildcards

Post by *petermad »

If I search in a list of files, and the list contains wildcards, the items that matches wildcards are not found if "Search in subdirectories" is set to "Current dir only".

To reproduce:
1. Go to TC's program directory.
2. Make a file (list.txt) with this list:

Code: Select all

contplug.ini
BLAKEX64.DLL
CGLPT64.SYS
totalcmd*.*
*.dll
3. Open the Find Files dialog (Alt+F7)-
4. Put @list.txt in the "Search in" field.
5. In the "Search in subdirectories" dropdown select "Current dir only"
6. Start the search.
I get this result:

Code: Select all

[C:\totalcmd\}
[C:\totalcmd\]
C:\totalcmd\contplug.ini
C:\totalcmd\BLAKEX64.DLL
C:\totalcmd\CGLPT64.SYS
Notice that [C:\totalcmd\] is listed twice, and that files that matches totalcmd*.* or *.dll is NOT in the search result - which I would have expected.
_______________

7. Now do the same, but in step 5 change "Current dir only" to "1 level(s)"
8. Start the search.
Now I get the list I expected with "Current dir only":

Code: Select all

C:\totalcmd\contplug.ini
C:\totalcmd\BLAKEX64.DLL
C:\totalcmd\CGLPT64.SYS
C:\totalcmd\TOTALCMD.CHM
C:\totalcmd\TOTALCMD.GID
C:\totalcmd\TOTALCMD64.EXE
C:\totalcmd\TOTALCMD64.EXE.MANIFEST
C:\totalcmd\TotalcmdDark.chm
C:\totalcmd\Tc7z64.dll
C:\totalcmd\TCLZMA64.DLL
C:\totalcmd\TCshareWin10x64.dll
C:\totalcmd\TCUNZL64.DLL
C:\totalcmd\UNRAR64.DLL
C:\totalcmd\wciconex.dll
C:\totalcmd\WCMICON2.DLL
C:\totalcmd\WCMICONS.DLL
C:\totalcmd\WCMZIP64.DLL
Here I would expect to also get .dll files in subdirectories like for example C:\totalcmd\Filter64\AutoPitch.dll and C:\totalcmd\Filter64\SoundTouchDLL_x64.dll as well as .dll files from C:\totalcmd\
_______________

Or in other words - I expect to find the same .dll files with this setting:
Search for: *.dll
Search in: c:\totalcmd\
Search in subdirectories: Current dir only

and with this setting:
Search for:
Search in: @list.txt
Search in subdirectories: Current dir only

It does not make any difference if I use full path in list.txt (for example: c:\totalcmd\*.dll).
It makes no difference whether 'Everything' is enabled or not.
Last edited by petermad on 2022-08-24, 23:54 UTC, edited 6 times in total.
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
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 10.50] Unexpected search result for list search

Post by *white »

Confirmed, I noticed that too.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10.50] Unexpected search result for list search

Post by *ghisler(Author) »

It looks like pattern matching isn't supported in "Current dir only" mode. I will check it.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 10.50] Unexpected search result for list search

Post by *white »

ghisler(Author) wrote: 2022-08-09, 06:53 UTC It looks like pattern matching isn't supported in "Current dir only" mode. I will check it.
Level 1 seems to give the results one would expect for Current dir only, level 2 seems to give the results one would expect for level 1, etc.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10.50] Unexpected search result for list search

Post by *petermad »

2ghisler(Author)
It looks like pattern matching isn't supported in "Current dir only" mode. I will check it.
Not only in that mode - but also in "1 level(s)" mode - I don't get files in for example the Filter64 directory. It looks more that the pattern search skips one level when searching in @list.txt
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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10.50] Unexpected search result for list search

Post by *ghisler(Author) »

2petermad
"white" seems to have figured it out: It's all shifted by one level, so try 2 levels to find files in Filter64.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Solved [TC 10.50] Unexpected search result for list search

Post by *petermad »

history.txt wrote:10.08.22 Fixed: Search, use list file in "Search in", e.g. @c:\totalcmd\list.txt containing wildcards like *.dll: "Search in subdirectories" was off by 1, e.g. "1 levels" only searched the base directory (32/64)
Confirmed fixed in TC 10.51rc1 :-)
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
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Solved [TC 10.50] Unexpected search result for list search

Post by *white »

petermad wrote: 2022-08-10, 18:33 UTC Confirmed fixed in TC 10.51rc1 :-)
Confirmed, however the same problem exist for entries in the list file that are directories.

The Help says:
Help - Find files: General wrote:
Sample list: Description
c:\testdir\ Searches "c:\testdir" for files defined in "search for"
Create the following files (with any content) and folder structure:
c:\test\file.txt
c:\test\Level 1\file.txt
c:\test\Level 1\Level 2\file.txt
Also create the file "c:\test\list.txt" with contents "c:\test\" (or "c:\test")

Now search using the following options:

Code: Select all

Search for:                file.txt
Search in:                 @c:\test\list.txt
Search in subdirectories:  current dir only
The results are:
[c:\test]
Results with "Search in subdirectories" set to 1 level:
c:\test\file.txt
Results with "Search in subdirectories" set to 2 levels:
c:\test\file.txt
c:\test\Level 1\file.txt
Results with "Search in subdirectories" set to 3 levels:
c:\test\file.txt
c:\test\Level 1\file.txt
c:\test\Level 1\Level 2\file.txt
Probably this works this way to be able to load a file/folder list using search. Since version 10 however it is possible to load a file/folder list with the command LOADLIST.

Either this should be changed or the Help should be updated so it is explained.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Solved [TC 10.50] Unexpected search result for list search

Post by *petermad »

Confirmed - The results are 1 level incorrect when having directories in list.txt
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
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10.50] Unexpected search result for list search

Post by *ghisler(Author) »

I only changed the behaviour when there are wildcards in the line of the search file. Why?

I think that this second case is different: Only current directory should find just the directory itself. 1 level deep should go one level into the directory.

Also when you check "currrent dir only", TC does an exact match of the entries in the list and ignores the "search for" field, that's why c:\totalcmd is found. For example, if the file contains
c:\totalcmd\
c:\totalcmd\history.txt
and you make a search with "currrent dir only", it finds this folder and file and ignores what's in "Search for". When you allow one or more subdirs, it will search the directory c:\totalcmd\ and use the "Search for" field for matches.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 10.50] Unexpected search result for list search

Post by *petermad »

Only current directory should find just the directory itself.
Maybe this should be mentioned in the help then.
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
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 10.50] Unexpected search result for list search

Post by *white »

ghisler(Author) wrote: 2022-08-11, 07:50 UTC I only changed the behaviour when there are wildcards in the line of the search file. Why?

I think that this second case is different: Only current directory should find just the directory itself. 1 level deep should go one level into the directory.
Don't pretend this is logical. The only reason for this is for historic reasons, to be able to load a list from file.

If you search for a file, that file is searched. If you search for a folder, normally the contents of the folder is searched.

Searching for
c:\test
c:\test\
c:\test\*.*

should give the same results if c:\test is a folder. Similar to the dir command and similar to specifying a folder in the Search in field and similar to when "Search in subdirectories" is set to anything other than "current dir only".

Limiting search depth should only limit the search results, not do a different search and give different results.
ghisler(Author) wrote: 2022-08-11, 07:50 UTC Also when you check "currrent dir only", TC does an exact match of the entries in the list and ignores the "search for" field, that's why c:\totalcmd is found.
As mentioned, this isn't what the Help says.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10.50] Unexpected search result for list search

Post by *ghisler(Author) »

When you make a search which finds folders and then use "F2 search in found files/folders", it also behaves like this: "current dir only" will find just the folder, "1 level(s)" will find the files in that folder, etc. So it seems logical to do the same also when using a list file.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 10.50] Unexpected search result for list search

Post by *white »

ghisler(Author) wrote: 2022-08-11, 13:28 UTC When you make a search which finds folders and then use "F2 search in found files/folders", it also behaves like this: "current dir only" will find just the folder, "1 level(s)" will find the files in that folder, etc. So it seems logical to do the same also when using a list file.
Well, that's not logical too.
  • Create a file c:\test123\test123.txt
  • Go to the root of drive c:
  • Open Search
  • Set "Search in subdirectories" to "current dir only" and start the search
  • Now the search results show the files and folders in the root of drive c:
  • Enable "F2 Search in found files/folders"
  • In the "Search for" field enter "test"
If you now search with "Search in subdirectories" set to "current dir only" the result will be:
[c:\test123]
But if you instead search with "Search in subdirectories" set to "1 level" the result will be:
c:\test123\test123.txt
Note that [c:\test123] is missing here.

That's because searching with search level 1 is actually searching at base level in this scenario and searching with "current dir only" is not searching at base level, but searching in search results list only.

You wanted to be able to search in file/folder list only, either a list in a file or the search results list. Instead of creating a new option "file/folder list only" you shifted the search depth one level and misused the "current dir only" option for this.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 10.50] Unexpected search result for list search

Post by *ghisler(Author) »

The idea was that you could load a list of files and folders into the program via the search function, so they only get added when they exist. I will probably break a lot of saved searches if I changed that now. In the case of c:\path\*.ext it was logical to change it because the result was definitely wrong. But in the other cases it's really debatable which one is right and which one is wrong. Therefore I will not change it at this time, sorry.

Since we can't come to an agreement here, I will move this thread to "will not be changed" soon.
Author of Total Commander
https://www.ghisler.com
Post Reply