You are currently offline, waiting for your internet to reconnect

Using ATTRIB, CHKDSK, or DIR Command to Locate Files

This article was previously published under Q89727
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
SUMMARY
Locating files on your hard drive can be accomplished with the MS-DOSATTRIB and CHKDSK commands. With MS-DOS 5.0, 6.0, or 6.2, you can locatefiles using the DIR command. These commands are also very useful whensearching for multiple copies of a file.
MORE INFORMATION
The MS-DOS 5.0 and later internal command DIR provides an /S option thatallows you to search all subdirectories for occurrences of the specifiedfile. For example, the following command will find the COMMAND.COM file inevery directory on the C drive:
dir c:\command.com /s
In MS-DOS versions 3.3 and later, the MS-DOS external command ATTRIB can beused to check for the existence of a file on a specific drive. Thefollowing command issued from the root directory (C:\>) will find theCOMMAND.COM file in every directory on drive C and display theirattributes:
attrib c:\command.com /s
NOTE: When using DIR or ATTRIB, you must specify that the search startat the root path in order to search the entire drive, or you canspecify a pathname if you want to restrict the search to a certainbranch of the directory tree.

With MS-DOS versions 2.0 and later, you can locate a file on a driveby using the MS-DOS external commands CHKDSK and FIND. For example,the following will find COMMAND.COM:
chkdsk c: /v | find "COMMAND.COM"
Note: Because the FIND command is case sensitive, you must specify thefilename in capital letters. Also, because the pipe creates atemporary file, you must have write access to the currentdisk/directory.

When using the DIR and ATTRIB commands, issue the command from theroot directory to include all locations of the file on a disk. Whenusing the CHKDSK command, all copies of the file are displayedregardless of the directory you're in.
6.22 3.10 3.20 3.30 3.30a 4.00 4.00a 5.00 5.00a 6.00 6.20
Properties

Article ID: 89727 - Last Review: 11/16/2006 05:37:13 - Revision: 2.1

  • Microsoft MS-DOS 2.11 Standard Edition
  • Microsoft MS-DOS 3.1
  • Microsoft MS-DOS 3.2 Standard Edition
  • Microsoft MS-DOS 3.21 Standard Edition
  • Microsoft MS-DOS 3.3 Standard Edition
  • Microsoft MS-DOS 3.3a
  • Microsoft MS-DOS 4.0 Standard Edition
  • Microsoft MS-DOS 4.01 Standard Edition
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition
  • KB89727
Feedback