Find a Directory/Folder with CMD without knowing full path

So at the root of the drive:

dir <Folder Name> /AD /s

  1. switch to the root-search-folder (e.g. C:)
  2. type dir /S /P <file or foldername> (/P pauses after each screenful of information)

If you'd like a list of all occurances of a specific filename, you can simply redirect the output to a file:

dir /S <filename> > c:\results.txt

You can also narrow down your results by using the /A switch of the dir command. If you'd like to only list directories, you can append /AD to your command:

dir /S /P <filename> /AD

Other possibilities are:

 /A          Displays files with specified attributes.
 attributes   D  Directories                R  Read-only files
              H  Hidden files               A  Files ready for archiving
              S  System files               I  Not content indexed files
              L  Reparse Points             -  Prefix meaning not

If you'd like to know more about the dir command, just type dir /?into your cmd.

Tags:

Command Line