Feed list of files to listbox from text file (2022)

English support forum

Moderators: Hacker, petermad, Stefan2, white

Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

When searching files in branch mode (Ctrl+B) from txt files that containing filenames, we do not have to put in this txt list neither whole path nor relative patch. We can activate RegEx mode in search dialog (Alt+F7) and put '*' (asterisk sign) before each filename.

File names TXT:

*first file name.pdf
*second_file-name.txt
*other FILE.odt

We put location to locatin to FILE_LIST.TXT in "Search in" field with '@':
@D:\folder\sub folder\Folder That We Want to Search in for Filenames\FILE_LIST.txt

if we type:
@D:\Folder That We Want to Search in for Filenames\FILE_LIST.txt
then whole drive D will be used for searching

And going further I'm interested if we can select list of filenames form different drive to search in another drive.
Is something like below is possible?

Filenames from:
C:\File List.txt

Search in:
D:\folder\sub folder\Folder That We Want to Search in for Filenames\


( split from Thread of 2013 https://ghisler.ch/board/viewtopic.php?p=267878#p267878 )
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50865
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Feed list of files to listbox from text file (2022)

Post by *ghisler(Author) »

Sorry, I cannot reproduce that. If I put
@D:\Folder That We Want to Search in for Filenames\FILE_LIST.txt
in the "Search in" field and the file doesn't exist, I get a warning that there is no such file.

Maybe I just misunderstood you?
Author of Total Commander
https://www.ghisler.com
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

That's the behaviour I've meant:
Gallery

We have files in certain directory in different subfolders:
[img]https://i.postimg.cc/YvsQ6L1w/0-folder-left-and-parent-right-panel.png[/img]
a branch view of this:
[img]https://i.postimg.cc/ns9B0Vk9/0b-folder-Branch-view-Ctrl-B.png[/img]

There are files with file names and/or paths:

+++ find 'qin' and '03-tk'.txt +++
*2022-02-01 18_23_03-tk.png
*qin2018.pdf

+++ find.txt +++
2022-02-01 18_23_03-tk.png
qin2018.pdf

+++ All files in 'Folder'+path.txt +++
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_03-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_22-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_29-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_35-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_40-tk.png
c:\Users\piotr\Downloads\Folder\Article\qin2018.pdf
c:\Users\piotr\Downloads\Folder\Shapes_from_Custom_Shape_Tutorial.odg

Search in: @find 'qin' and '03-tk'.txt
without RegEx
gives:
[img]https://i.postimg.cc/jn4zP8h8/1-find-star-file.png[/img]
[img]https://i.postimg.cc/G9FPW21k/1-find-Reg-Ex-star-file.png[/img]
Files are found regardless of the RegEx parameter.

Search in: @find.txt
without RegEx
gives:
[img]https://i.postimg.cc/ppPQRH23/2-find-file.png[/img]
[img]https://i.postimg.cc/Vd4qNVvv/2-find-Reg-Ex-file.png[/img]
Lack of results.

Search in: @All files in 'Folder'+path.txt
without RegEx
gives:
[img]https://i.postimg.cc/sMXpG4Gc/3-find-path-file.png[/img]
[img]https://i.postimg.cc/34Mp6MSS/3-find-Reg-Ex-path-file-why.png[/img]
Files are found regardless of the RegEx parameter.
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

But my original question is:
Can we place file list in location e.g.: D:\find 'qin' and '03-tk'.txt
And Search in folder: c:\Users\piotr\Downloads\Folder\
Can we?

So I want to search for files in one location and be able to refer to search list form another location.
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

And BTW in which circumstances Search only in selected directories/files option is available?
User avatar
Horst.Epp
Power Member
Power Member
Posts: 7012
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Feed list of files to listbox from text file (2022)

Post by *Horst.Epp »

Piotr285 wrote: 2022-03-17, 10:43 UTC And BTW in which circumstances Search only in selected directories/files option is available?
Of course when you select some files and then invoke the search menu.
Windows 11 Home, Version 24H2 (OS Build 26100.4351)
TC 11.55 RC7 x64 / x86
Everything 1.5.0.1395a (x64), Everything Toolbar 1.5.5.0, Listary Pro 6.3.2.88
QAP 11.9.0.4 x64
User avatar
Gral
Power Member
Power Member
Posts: 1609
Joined: 2005-01-26, 15:12 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Gral »

Did you read help for this?
Search in: Here you can enter one or more starting directories, separated by ";". You can also start the search inside an archive.
You can enter the name of a text file (ANSI, UTF-8 or UTF-16, the latter two with BOM) containing a list of files and directories to be searched, in the form @c:\path\filelist.txt. The file must contain one file/directory name per line, either an absolute path, or relative to the location of the list file. The text file also supports wildcards and regular expressions. The "Search for" field is ignored when searching from list.
User avatar
nsp
Power Member
Power Member
Posts: 1948
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Feed list of files to listbox from text file (2022)

Post by *nsp »

Piotr285 wrote: 2022-03-17, 10:37 UTC But my original question is:
Can we place file list in location e.g.: D:\find 'qin' and '03-tk'.txt
And Search in folder: c:\Users\piotr\Downloads\Folder\
Can we?

So I want to search for files in one location and be able to refer to search list form another location.
if you search in file list, the only source is the file prefixed by @. (keep also in mind that the "Search For" field is ignored and the "Search In" should only contain the list File.)

If you want to find from this list only file under a specific path, you can use plugin tc.path, tc.ext ... This will replace your "Search For" field.
You cannot mix file list and folder source !
The trick is to add your folder inside the listFile like C:\Folder\*.*, ....
User avatar
white
Power Member
Power Member
Posts: 5986
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Feed list of files to listbox from text file (2022)

Post by *white »

2Piotr285
It works as designed, but I can understand the confusion.

Piotr285 wrote: 2022-03-17, 10:31 UTC +++ All files in 'Folder'+path.txt +++
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_03-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_22-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_29-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_35-tk.png
c:\Users\piotr\Downloads\Folder\2022-02-01 18_23_40-tk.png
c:\Users\piotr\Downloads\Folder\Article\qin2018.pdf
c:\Users\piotr\Downloads\Folder\Shapes_from_Custom_Shape_Tutorial.odg

..
Search in: @All files in 'Folder'+path.txt
without RegEx
gives:
[img]https://i.postimg.cc/sMXpG4Gc/3-find-path-file.png[/img]
[img]https://i.postimg.cc/34Mp6MSS/3-find-Reg-Ex-path-file-why.png[/img]
Files are found regardless of the RegEx parameter.
If I remember it correctly, this is why @file was added. To load files from a file and show them in the panel if they exist. The rest was added later.
Piotr285 wrote: 2022-03-17, 10:31 UTC +++ find.txt +++
2022-02-01 18_23_03-tk.png
qin2018.pdf

..
Search in: @find.txt
without RegEx
gives:
[img]https://i.postimg.cc/ppPQRH23/2-find-file.png[/img]
[img]https://i.postimg.cc/Vd4qNVvv/2-find-Reg-Ex-file.png[/img]
Lack of results.
If there are no wildcards or regex used in the line, a search is done for the a single file at specified location. If no path is specified, the path of @file is used.
So in this case, the search is done for:
  • c:\Users\piotr\Downloads\2022-02-01 18_23_03-tk.png
  • c:\Users\piotr\Downloads\qin2018.pdf
Since these files don't exist, nothing is found.

To search for the files in all subfolders as well, you can use regex in the @file:

Code: Select all

<^2022-02-01 18_23_03-tk\.png$
<^qin2018\.pdf$
Piotr285 wrote: 2022-03-17, 10:31 UTC +++ find 'qin' and '03-tk'.txt +++
*2022-02-01 18_23_03-tk.png
*qin2018.pdf

...
Search in: @find 'qin' and '03-tk'.txt
without RegEx
gives:
[img]https://i.postimg.cc/jn4zP8h8/1-find-star-file.png[/img]
[img]https://i.postimg.cc/G9FPW21k/1-find-Reg-Ex-star-file.png[/img]
Files are found regardless of the RegEx parameter.
When using wildcards, subfolders are searched as well. All files ending with "2022-02-01 18_23_03-tk.png", ending with "2022-02-01", exactly matching "18_23_03-tk.png" and ending with "qin2018.pdf" are searched in c:\Users\piotr\Downloads and subfolders.
To search for full file name "2022-02-01 18_23_03-tk.png", add quotes like this:

Code: Select all

*"2022-02-01 18_23_03-tk.png"
*qin2018.pdf
Piotr285 wrote: 2022-03-17, 10:43 UTC And BTW in which circumstances Search only in selected directories/files option is available?
Not in combination with "Search in @file". That's not supported. (And would create even more confusion.)
Piotr285 wrote: 2022-03-17, 10:31 UTC Files are found regardless of the RegEx parameter.
RegEx applies to the "Search for" field and this field is only used for lines in @file that contain folder name only (ends with \).
For other lines you must include a regex on that line.
Gral wrote: 2022-03-17, 11:22 UTC Did you read help for this?
...
The "Search for" field is ignored when searching from list.
Except the next line says it isn't ;)
Last edited by white on 2022-03-18, 15:12 UTC, edited 1 time in total.
Reason: small correction: search for *qin2018.pdf searches for file names ending with "qin2018.pdf"
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

Horst.Epp wrote: 2022-03-17, 10:51 UTC Of course when you select some files and then invoke the search menu.
OK, thank you! What a blindness of mind.

nsp wrote: 2022-03-17, 12:36 UTC You cannot mix file list and folder source !
The trick is to add your folder inside the listFile like C:\Folder\*.*, ....
Thank you.

To clarify, with list (+++ find+path.txt +++):
c:\Users\piotr\Downloads\*2022-02-01 18_23_03-tk.png
c:\Users\piotr\Downloads\*qin2018.pdf

the search works as I intended:
[img]https://i.postimg.cc/5X3SDLsC/4-find-path-star-file.png[/img]
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

Gral wrote: 2022-03-17, 11:22 UTC Did you read help for this?
Search in: Here you can enter one or more starting directories, separated by ";". ...
No, thank you for this citation.

To clarify, it works as follows:
Search: maj
Search in: p:\Różne\; p:\Dokumenty\
[img]https://i.postimg.cc/fk3LFdwg/5-find-in-entered-directories.png[/img]
User avatar
Gral
Power Member
Power Member
Posts: 1609
Joined: 2005-01-26, 15:12 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Gral »

I'm still not sure what you really want to achieve.
Maybe there is a different solution to your needs?
E.g. save a search for later use? - tab "Ładuj/ Zapisz"
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

Gral wrote: 2022-03-17, 14:34 UTC I'm still not sure what you really want to achieve.
...
We prepare summary sheets of the results of individual experiments, stored on the server in separate *.xlsx/*.ods files.
This is done either by direct connection in a spreadsheet or by a query (MS Excel: Power Query).
These files have long names according to some scheme. They are stored in different directories but have unique names.
[img]https://i.postimg.cc/RWFB1yqp/Files-usage.png[/img]

One use case
When working with a direct link, it's a good idea to specify only the files used in the summary sheet, rather than throwing yourself into tons of files. This is because sometimes you need to make small changes to these particular files.

Another use case
When you copy individual files to a local folder and import the data using Power Query, it's also useful to know where they came from so that you can simply copy them again from server in case of changes made to server versions.

In both cases, it is very useful to have a file_list.txt file to refer to these files years later (so as not to confuse them).
[img]https://i.postimg.cc/JsKHhG2D/Data-storages.png[/img]
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

Piotr285 wrote: 2022-03-18, 13:41 UTC Another use case
...so that you can simply copy them again from server in case of changes made to server versions.
And additionally, I'm wondering how to copy/overwrite the local versions to the server while preserving the existing server folder structure?
Piotr285
Junior Member
Junior Member
Posts: 10
Joined: 2022-03-14, 14:54 UTC

Re: Feed list of files to listbox from text file (2022)

Post by *Piotr285 »

white wrote: 2022-03-17, 13:05 UTC ...
Gral wrote: 2022-03-17, 11:22 UTC Did you read help for this?
...
The "Search for" field is ignored when searching from list.
Except the next line says it isn't ;)
Thank you white for the solid explanation!

What is an example of the exception you mentioned?
Post Reply