|Purpose:||Search for files by name or contents|
|Format:||FFIND [/8 /A[[:][-]rhsadecijopt /B /C /D[list] /E["text"] /F /G /H /I /I"text" /K /L /Ln /M /N[dehjs] /O:[-]acdeginorstuz /P /Q /R /S[[+]n] /[T|X]"xx" /U /V /W /Y /+n /-n] [@file] file...|
|list||A list of disk drive letters (without colons).|
|file||The file, directory, or list of files or directories to display.|
Supports extended wildcards, ranges, multiple file names, and include lists.
Internet: Can be used with FTP Servers.
FFIND is a flexible search command that looks for files based on their names and their contents. Depending on the options you choose, FFIND can display filenames, matching text, or a combination of both in a variety of formats.
If you don't supply a file name, FFIND will read from standard input. (This allows you to pipe or redirect input to FFIND.)
If you want to search for files by name, FFIND works much like the DIR command. For example, to generate a list of all the .BTM files in the current directory, you could use the command
The output from this command is a list of full pathnames, followed by the number of files found.
For example, if you want to limit the output to a list of *.BTM files which contain the string color, you could use this command instead:
ffind /t"color" *v.btm
The output from this command is a list of files that contain the string color along with the first line in each file that contains that string. By default, FFIND uses a case-insensitive search, so the command above will include files that contain COLOR, Color, color, or any other combination of upper-case and lower-case letters.
If you would rather see the last line of each file that contains the search string, use the /R option, which forces FFIND to search from the end of each file to the beginning. This option will also speed up searches somewhat if you are looking for text that will normally be at the end of a file, such as a signature line:
ffind /r /t"Sincerely," *.txt
You can use TCC extended wildcards in the search string to increase the flexibility of FFIND's search. 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:
ffind /c/t"Ju[nl][ey]" *.txt
If you want to search for text that contains wildcard characters (*, ?, [, or ]), you can use the /I option to force FFIND to interpret these as normal characters instead of wildcards. The following command, for example, finds all .TXT files that contain a question mark:
ffind /i/t"?" *.txt
Sometimes you may need to search for data that cannot be represented by ASCII characters. You can use FFIND's /X option to represent the search string in hexadecimal format (this option also changes the output to show hexadecimal offsets rather than text lines). With /X, the search must be represented by pairs of hexadecimal digits separated by spaces (in the example below, 41 63 65 is the hex code for "Ace"):
ffind /x"41 63 65" *.txt
You can also search using regular expressions using the /E option. See Regular Expression Syntax for supported expressions.
When you use FFIND on an LFN drive, you must quote any file names which contain white space or special characters.
FFIND can also find files on FTP servers. For example:
ffind /t"Windows" ftp://ftp.microsoft.com/windows
You can also use the IFTP command to start an FTP session on a server, and then use an abbreviated syntax to specify the files and directories you want. For more information, see Using FTP/HTTP Servers and IFTP.
Note that searching for text in files on FTP servers (as in the command above) will be slow as the data from each file searched must be retrieved from the server and transferred to your computer to be checked for the search string.
FFIND sets three internal variables:
|%_ffind_matches||The number of matches|
|%_ffind_files||The number of files found|
|%_ffind_errors||The number of errors|
|/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.
|/B||Display file names only and omit the text that matches the search. This option is only useful in combination with /T or /X, which normally force FFIND to display file names and matching text.|
|/C||Perform a case-sensitive search. This option is only valid with /T, which defaults to a case-insensitive search. It is not needed with a /X hexadecimal search, which is always case-sensitive.|
|/D||Search all files on one or more drives. If you use /D without a list of drives, FFIND will search the drives specified in the list of files. If no drive letters are listed, FFIND will search all of the current drive. You can include a list of drives or a range of drives to search as part of the /D option. For example, to search drives C:, D:, E:, and G:, you can use either of these commands:|
ffind /dcdeg ...
ffind /dc-eg ...
Drive letters listed after /D will be ignored when processing file names which also include a drive letter. For example, this command displays all the .BTM files on C: and E:, but only the .BAT files on D:
ffind /s /dce *.btm d:\*.bat
|/E"text"||Search for a regular expression. The regular expression must be contained in double quotes if it contains spaces, punctuation, or wildcard characters. See also /T. The maximum line length supported by /E is 16Mb.|
|/H||Don't search for text in binary files. By default, this includes .exe, .sys, .dll, .zip, and .chm extensions. You can define your own list by setting the "BINARY_FILES" environment variable. For example, to ignore .exe, .sys, and .dll files:|
|/I||Only meaningful when used in conjunction with the /T "text" option. Suppresses the recognition of wildcard characters in the search text. This option is useful if you need to search for characters that would normally be interpreted as wildcards: *, ?, [, and ].|
|/I"text"||Select filenames by matching text in their descriptions. The text can include wildcards and extended wildcards. The search text must be enclosed in double quotes, and must follow the /I immediately, with no intervening spaces. You can select all filenames that have a description with /I"[?]*", or all filenames that do not have a description with /I"".|
|/L||Include the line number for each text line displayed for text searches. FFIND numbers lines beginning with 1. A new line is counted for every CR or LF character (FFIND determines automatically which character is used for line breaks in each file), or when line length reaches the command line length limit, whichever comes first.|
|/Ln||The number of leading and trailing lines to display on a text search match. Each successive group of lines in a file will be separated by a "----" header.|
|/N||Reverse the meaning of the search, i.e., report only files which contain no match. Setting /N will also set /B, i.e. searches are on a file-by-file basis; FFIND cannot search for all lines without match.|
A /N with one or more of the following arguments has an alternate meaning:
|d||Skip hidden directories|
|e||Don't display errors.|
|s||Don't display the summary.|
You may use any combination of the following sorting options; if multiple options are used, the listing will be sorted with the first sort option as the primary key, the next as the secondary key, and so on:
|-||Reverse the sort order for the next option|
|a||Sort names and extensions in standard ASCII order, rather than sorting numerically when digits are included in the name or extension|
|c||Sort by compression ratio (the least compressed file in the list will be displayed first)|
|d||Sort by date and time (oldest first); for drives which support long file names|
|e||Sort by extension|
|g||Group subdirectories first, then files|
|i||Sort by file description (ignored if /O:c is also used)|
|n||Sort by filename (this is the default)|
|o||Sort by owner|
|r||Reverse the sort order for all options|
|s||Sort by size|
|/P||Wait for a key to be pressed after each screen page before continuing the display. Your options at the prompt are explained in detail under Page and File Prompts.|
|/Q||Don't display any output, but set the FFIND internal variables (%_ffind_matches, %_ffind_files, and %_ffind_errors).|
|/R||Only meaningful when used in text searches in conjunction with the /T "text" or /X options. Searches each file from the end backwards to the beginning. This option is useful if you want to display the last occurrence of the search string in each file instead of the first (the default). It may also speed up searches for information that is normally at the end of a file, such as a signature.|
|/S||Display matches from the source directory and all of its subdirectories. If you don't specify a path with the file to search, FFIND will default to starting in the current directory.|
By default, FFIND processes only those subdirectories without the Hidden or System attributes. To view hidden or system subdirectories use /A along with /S.
If you specify a number following the /S, FFIND 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, FFIND 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"text"||Specify the text search string. /T must be followed by a text string in double quotes (e.g., /t"color"). FFIND will perform a case-insensitive search unless you also use the /C option. For a hexadecimal search and/or hexadecimal display of the location where the search string is found, see /X. You can specify a search string with either /T or /X, but not both.|
|/TE"text"||Converts a text string (see /T above) to a regular expression and then does a regex search. You don't need to learn regular expressions, and /TE will run 10x faster than /T. The only limitation is the maximum line length in the file must be < 16Mb.|
|/V||Show every matching line on a text search. FFIND's default behavior is to show only the first matching line, then to the next file. This option is only valid with /E, /T and /X.|
|/W||Display the Take Command Find Files dialog. This option allows you to select the search options in a dialog instead of entering them on the command line. You cannot combine /W with any other FFIND option.|
If /X is followed by one or more pairs of hexadecimal digits in quotes (e.g., /x"44 63 65"), FFIND will search for that exact sequence of characters or data bytes without regard to the meaning of those bytes as text. If those bytes are found, the offset is displayed (in both decimal and hexadecimal). A search of this type will always be case-sensitive.
If /X is not followed by a hexadecimal search string it must be used in conjunction with /E or /T, and will change the output format to display offsets (in both decimal and hexadecimal) rather than actual text lines when the search string is found. For example, this command uses /T to display the first line in each BTM file containing the word "hello":
ffind /t"hello" *.btm
1 line in 1 file
If you use the same command with /X, the offset is displayed instead of the text:
ffind /t"hello" /x *.btm
1 line in 1 file
You can specify a search string with either /T or /X, but not both.
|/Y||Prompt to stop searching after each match. This option is most useful when you are using FFIND to search for one specific file, and don't want to display all files which include a particular search string.|