Hello,
sorry for question. More likely someone has asked it before, but I couldn't find the answer.
I read in help (F1) that for searching files one may use the text file with a list of files (dirs) to search for.
In the "Search in " field you should input something like in the form @c:\path\filelist.txt.
Also it is said that text file also supports wildcards and regular expressions.
With a list of files in that text file TC perform search well .However if I write Regex in that text file TC stopps searching.
Am I do something incorrect?
Regex in search list file
Moderators: Hacker, petermad, Stefan2, white
Re: Regex in search list file
In the sample list you see that you have to start the regular expression with a less than sign "<", followed by a regular expression.Total Commander's Help wrote:
Sample list: Description c:\testdir\ Searches "c:\testdir" for files defined in "search for" c:\testdir\*.txt *.doc Searches "c:\testdir" for txt and doc files c:\testdir\<regular expression Searches "c:\testdir" using regular expression c:\testdir\filename.txt Searches just for "filename.txt" in "c:\testdir"
So a line in the list file could look like this:
Code: Select all
c:\testdir\<\.pdf$
For lines in the list file containing a folder name only the Search for field is used.
So if you put "\.txt$" (without quotes) in the Search for field and enable RegEx, this regex search will be done for these lines.
For example:
Code: Select all
Search for: \.txt$
Search in: @mylistfile
RegEx: Enabled
Contents of mylistfile:
c:\testdir1\
c:\testdir2\
c:\testdir3\<\.pdf$
c:\testdir4\*.doc
Re: Regex in search list file
Hi and welcome.
- open the search
- click at [Help]
- read:
Search in: You can enter the name of a text file 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 now also supports wildcards ( * and ? ) and regular expressions.
c:\testdir\*.txt *.doc --- Searches "c:\testdir" for txt and doc files
c:\testdir\<regular expression --- Searches "c:\testdir" using regular expression
Note the enabler sign < to treat the following as RegEx
- - -
BTW: the German help only talks about Platzhalter * und ?
Suchen in: Sie können auch eine Textdatei mit einer Liste der zu durchsuchenden Dateien und Verzeichnisse angeben, in der Form @c:\Pfad\Dateiname.txt.
Die Textdatei muss einen Datei-/Verzeichnisnamen pro Zeile enthalten, entweder als absoluten Pfad, oder relativ zum Verzeichnis der Listendatei.
In der Listendatei dürfen nun auch die Platzhalter * und ? (sowie Reguläre Ausdrücke) verwendet werden.
c:\testdir\*.txt *.doc --- Sucht in "c:\testdir" nach txt- und doc-Dateien
c:\testdir\<RegEx --- Sucht in "c:\testdir" mit dem regulären Ausdruck
- open the search
- click at [Help]
- read:
Search in: You can enter the name of a text file 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 now also supports wildcards ( * and ? ) and regular expressions.
c:\testdir\*.txt *.doc --- Searches "c:\testdir" for txt and doc files
c:\testdir\<regular expression --- Searches "c:\testdir" using regular expression
Note the enabler sign < to treat the following as RegEx
- - -
BTW: the German help only talks about Platzhalter * und ?
Suchen in: Sie können auch eine Textdatei mit einer Liste der zu durchsuchenden Dateien und Verzeichnisse angeben, in der Form @c:\Pfad\Dateiname.txt.
Die Textdatei muss einen Datei-/Verzeichnisnamen pro Zeile enthalten, entweder als absoluten Pfad, oder relativ zum Verzeichnis der Listendatei.
In der Listendatei dürfen nun auch die Platzhalter * und ? (sowie Reguläre Ausdrücke) verwendet werden.
c:\testdir\*.txt *.doc --- Sucht in "c:\testdir" nach txt- und doc-Dateien
c:\testdir\<RegEx --- Sucht in "c:\testdir" mit dem regulären Ausdruck
Re: Regex in search list file
Interesting, using @myfile with regex lines like c:\testdir3\<\.pdf$ works fine ( I left "Search for" field blank). However, when I paste c:\testdir3\<\.pdf$ directly in "Search in" field I got the message "Search path not found!". The same message displayed if I input directly in the "Search field" the c:\testdir3\*.pdf.
Re: Regex in search list file
The line inside search file c:\testdir3\<\.pdf$ with regex is equivalent to :ivasht2 wrote: 2022-03-25, 20:11 UTC Interesting, using @myfile with regex lines like c:\testdir3\<\.pdf$ works fine ( I left "Search for" field blank). However, when I paste c:\testdir3\<\.pdf$ directly in "Search in" field I got the message "Search path not found!". The same message displayed if I input directly in the "Search field" the c:\testdir3\*.pdf.
Shearch for: <\.pdf$
Search in:c:\testdir3\
You cannot enter a path in search for field !
Re: Regex in search list file
thanks, I noticed entering the symbol '<' before regex in the "Search for" does turning on the switch in the "RegEx" field.