Please enable JavaScript to view this site.

Navigation: TCC > Commands

FSEARCH

Scroll Prev Top Next More
Purpose:Search files for the specified text

 

Format:FSEARCH [/= /+n /-n /8 /A[[:][-]rhsadecijopt /B /C /E"regex" /F /G /H /I /L /N[dehjs] /:0 /Q /S[[+]n] /T"text" /U /V /Y /Z] [path] filename

 

File Selection

 

Supports extended wildcards, ranges, and include lists.

 

Usage:

 

FSEARCH is a modern replacement for the aged FFIND. New features will only be implemented in FSEARCH, not FFIND.

 

FSEARCH will automatically determine the file type (ASCII, UTF8, or UTF16). You can also tell FSEARCH to assume UTF8 files with the /8 option. (This is slightly faster because FSEARCH doesn't have to pre-scan the files trying to determine the encoding.)

 

You can use TCC extended wildcards in the search string. For example, the following command will find .TXT files which contain either the string June or July. It will also find Juny and Jule. The /C option makes the search case-sensitive:

 

fsearch /c /t"Ju[nl][ey]" *.txt

 

You can also search using regular expressions using the /E option. See Regular Expression Syntax for supported expressions.

 

When you use FSEARCH on an LFN drive, you must quote any file names which contain white space or special characters.

 

You can search for directory names (but not in combination with text searches). You must specify the start directory. For example:

 

fsearch /a:d /s startdirectory dirname

 

FSEARCH will read from STDIN (i.e., usually a pipe) if you don't specify path / filename. For example:

 

dir /s | fsearch /t"file47"

 

FSEARCH can also search the TCC CLIPn: and TMPn: pseudo-devices. (Searches in the clipboards and TMP files are always UTF-16.) For example:

 

dir /s | tmp5:

fsearch /t"file47" tmp5:

 

FSEARCH sets three internal variables:

 

_fsearch_errors - Errors when running FSEARCH (i.e., file/path not found, file locked, access denied, etc.)

 

_fsearch_files - The number of files containing one or more matches

 

_fsearch_matches - The total number of matches. (Note that unless you specify /V, FSEARCH will not count more than one match per file.)

 

If you don't enter any options, FSEARCH will default to /= (display the FSEARCH dialog).

 

Options:

 

/=Display the FSEARCH dialog

 

/+nSkip the first n matches

 

/-nStop after n matches

 

/8Instead of scanning the files for their type, they are assumed to be UTF8 (this is a little faster).

 

/A:...Select only those files that have the specified attribute(s) set. See Attribute Switches for information on the attributes which can follow /A:.

 

You can specify /A:= to display a dialog to help you set individual attributes.

 

/BOnly display filenames (no header or footer or summary or matching lines)

 

/CMatch case

 

/E"..."Regular expression search

 

/FStop after first match (overrides /V)

 

/GChange to the directory containing the first matching file (also sets /F and overrides /V)

 

/HDon't search for text in binary files. By default, this includes .exe, .dll, .sys, .chm, .zip, .pdb, .pch, .obj, .tar, .com, and .ewriter. You can define your own list by setting the "BINARY_FILES" environment variable.

 

For example, to ignore .exe, .sys, and .dll files:

 

BINARY_FILES=.exe;.sys;.dll

 

/IUsed with /T to tell FSEARCH to ignore wildcard characters (*, ?, and [...]).

 

/LDisplay line numbers for matching text

 

/N...Disable options:

 

DDon't scan hidden subdirectories
EDon't display errors
HNo header
JSkip junctions
SNo footer (summary)

 

/:0All files are assumed to be ASCII. This saves some time because FSEARCH doesn't have to examine each file to see if it is ASCII, UTF-8, or UTF-16.

 

/QDon't display any output. The internal variables (see below - _fsearch_errors, _fsearch_files, and _fsearch_matches are set).

 

/SSearch subdirectories of the specified (or default) path.

 

If you specify a number following the /S, FSEARCH will limit the subdirectory recursion to the number specified. For example, if you have a directory tree "\a\b\c\d\e", /S2 will only go to the "a", "b", and "c" directories.

If you specify a + followed by a number after the /S, FSEARCH will not search for files until it gets to that depth in the subdirectory tree. For example, if you have a directory tree \a\b\c\d\e, /S+2 will not find anything in \a or \a\b.

 

/T"..."Search for the matching text. Supports TCC wildcards (?, *, and [...]).

 

/UOnly display summary line (no filenames or matching lines; overrides /V)

 

/VDisplay all matching text (FSEARCH defaults to only looking for and displaying the first match in each file)

 

/YDisplay a "Continue Y/N" prompt after displaying each match

 

/ZHighlight the matched text