File selection difference: Direct use vs. Predefined filter

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
sevem
Junior Member
Junior Member
Posts: 7
Joined: 2013-09-07, 20:43 UTC

File selection difference: Direct use vs. Predefined filter

Post by *sevem »

For selecting files it is possible to use the Num + key on the numerical block and enter the selection you want. Alternatively you can define and store a filter to be used in the selection dialog.

I observed that the selection is different depending on the chosen method. When using a predefined filter not all files are included in the selection. Following example should illustrate the behaviour I observed.

My question: Is this intended behaviour, and where can I find a description to this? I searched but could not find any hint to this. I observed this in all version I currently use: TCMD 8.* and 7.52

--------
Example: In one place I have two directories (Dir1 and Dir2) and two files (File1 and File2).

1) In the file selection dialog (on pressing Num +) I enter "File1 Dir1". As result the directory Dir1 and the file File1 are selected.

2) In the file selection dialog I select 'Define...', enter "File1 Dir1" and save the filter giving the name Mask1. On using the selection dialog I select Mask1 in the list and press OK. Now I get the error "No matches found!"
There is no difference in case I use a semicolon as separation character.

3) In the file selection dialog I select 'Define...', enter "File1* Dir1*" and save the filter giving the name Mask2. On using the filter Mask2 directory Dir1 and file File1 are selected. The only difference is, that now I appended "*" to the end of each name. This works fine in this situation but fails, if there is another name with the same beginning (e.g. Dir1-old). In this situation more than expected gets selected. How can I avoid this?

Thanks for any hints
User avatar
petermad
Power Member
Power Member
Posts: 16116
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

You can use the file mask:

Code: Select all

dir1 file1 |?
to get the desired outcome. This will works for everything but files and folders with only on character in the name.
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
white
Power Member
Power Member
Posts: 5986
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: File selection difference: Direct use vs. Predefined fil

Post by *white »

sevem wrote:For selecting files it is possible to use the Num + key on the numerical block and enter the selection you want. Alternatively you can define and store a filter to be used in the selection dialog.

I observed that the selection is different depending on the chosen method. When using a predefined filter not all files are included in the selection. Following example should illustrate the behaviour I observed.

My question: Is this intended behaviour, and where can I find a description to this? I searched but could not find any hint to this.
You can find help by clicking the Help button in the Num + dialog and by clicking the Help button in the Define selection dialog. Yes the differences are intentional. Defined selections are actually the same as saved searched. Using saved searches in the Num + dialog was added later.
sevem wrote:3) In the file selection dialog I select 'Define...', enter "File1* Dir1*" and save the filter giving the name Mask2. On using the filter Mask2 directory Dir1 and file File1 are selected. The only difference is, that now I appended "*" to the end of each name. This works fine in this situation but fails, if there is another name with the same beginning (e.g. Dir1-old). In this situation more than expected gets selected. How can I avoid this?
By putting double quotes around the file names. Indeed, this is not clearly mentioned in the Help.

For names without spaces and no extension, you can also append a dot to the end of the name to force exact matching.
User avatar
petermad
Power Member
Power Member
Posts: 16116
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

By putting double quotes around the file names
This will not help in this case...
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
white
Power Member
Power Member
Posts: 5986
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

petermad wrote:
By putting double quotes around the file names
This will not help in this case...
You are right.

It seems when a dot (.), question mark (?) or asterisk (*) is somewhere in the search field, exact matching is turned on, space and semi colon become separators (1) and the pipe symbol becomes a separator for an exclude mask.

So you can simply add a space and a dot (also search for an empty file name). Or append a dot to one of the file names. Or add a search for some string that is not in any file name and includes dot, question mark or asterisk.

Code: Select all

Dir1 File1 "File name" .

Dir1. File1 "File name"

Dir1 File1 "File name" some.string
Dir1 File1 "File name" force_exact_matching?
Dir1 File1 "File name" *blablabla

Edit:
(1) The whole search string is always searched also. So searching for "test text.txt" (without the quotes) finds "test", "test.txt" and "test test.txt".
Last edited by white on 2014-01-12, 16:28 UTC, edited 3 times in total.
User avatar
white
Power Member
Power Member
Posts: 5986
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

white wrote:It seems when a dot (.), question mark (?) or asterisk (*) is somewhere in the search field, exact matching is turned on, space and semi colon become separators and the pipe symbol becomes a separator for an exclude mask.
So searching for

Code: Select all

File1|windows\
will search for files with file names containing "File1|windows"
petermad wrote:You can use the file mask:

Code: Select all

dir1 file1 |?
to get the desired outcome. This will works for everything but files and folders with only on character in the name.
I believe this to be a bad thing.
Searching for

Code: Select all

this file
will search files with file names containing "this file"
And searching for

Code: Select all

this file|?
will search files with exact file name "this" or "file"

In my opinion it would have been better if the pipe symbol would always be interpreted as separator between search string and exclude string. And that the exclude string would not influence the interpretation of the search string and vice versa.

Regretfully, I don't think Mr. Ghisler will be willing to change this (because it will break compatibility with previous versions of Total Commander).
User avatar
petermad
Power Member
Power Member
Posts: 16116
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

will search files with exact file name "this" or "file"
Yes, and that is exactly what sevem is asking for, I believe
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
sevem
Junior Member
Junior Member
Posts: 7
Joined: 2013-09-07, 20:43 UTC

Post by *sevem »

Thanks a lot for your help.

I did not think that there is such a deep story behind. For a long time I could live with the 'wildcard-solution' (with *). This stopped working when I had names that had the same beginning; this initiated my question.

And yes, I just was looking for a solution that searches for exact names.
Post Reply