Microsoft KB Archive/66529

Finding a File PSS ID Number: Q66529 Article last modified on 05-13-1991 PSS database name: PSS

Summary:

You can find a file on a drive with many subdirectories by using standard DOS commands. There are two methods. The first method is useful when a word processor can be used for searching purposes, or if you are unfamiliar with EDLIN. The second method is useful if no word processor is available.

= METHOD 1 (TREE /F >dirlist) =

DOS Versions
MS-DOS 3.20 or later IBM 2.0 or later

  Go to the root directory of the drive you want to search, as follows: C: CD

  Obtain the file list, as follows: TREE /F > dirlist   Load the list into Word for DOS, as follows: Word c:   Search for the filename, as follows:  Press ESC. Press S. Enter the filename. Press ENTER.</li></ol> </li></ol>

The TREE command produces an output similar to the following:

Directory path listing

Files: AUTOEXEC.BAT COMMAND.COM CONFIG.SYS

Path:

Subdirectories: None

Files: W5.BAT START.BAT WORKS.BAT

If you are searching for START.BAT, simply execute the search. When START.BAT is found, the path will be displayed on the Path line above the list of files in which START.BAT was found.

= METHOD 2A (CHKDSK /F > dirlist) =

DOS Versions
MS-DOS 2.00 or later

<ol style="list-style-type: decimal;">  Go to the root directory of the drive you want to search, as follows: C: CD

</li>  Obtain file list, as follows: CHKDSK /V > dirlist </li>  Load list into Word for DOS, as follows: Word c:\dirlist </li>  Search for filename, as follows: <ol style="list-style-type: lower-alpha;"> Press ESC.</li> Press S.</li> Enter the filename.</li> Press ENTER.</li></ol> </li></ol>

This method is essentially the same as method 1. It produces similar output.

= METHOD 2B (CHKDSK /V > dirlist) =

DOS Versions
MS-DOS 2.00 or later

<ol style="list-style-type: decimal;">  Go to the root directory of the drive you want to search, as follows: C: CD

</li>  Obtain the file list, as follows: CHKDSK /V > dirlist </li>  Search for file, as follows: TYPE dirlist | more </li></ol>

This method requires you to scan for the file manually with the TYPE command. An alternative to manual searching is to use the FIND command.

For example, to find all the batch files on a disk, type the following:

CHKDSK /V | FIND “BAT”

Note: The find command is case sensitive; therefore, DOS filenames must be entered in uppercase.

= METHOD 3: ATTRIB [[drive:][path]filename] /s =

DOS Versions
MS-DOS 3.20 or later

Copyright Microsoft Corporation 1991.