Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't know the full path to a folder, just the folder name. I would like to find everywhere where this folder is using CMD. Is there a command that does this?

I am looking for an equivalent to *nix's:

find . -name <folder name> -type d

Is there anything like that in Windows CMD? I know dir /s ...

share|improve this question
up vote 9 down vote accepted

So at the root of the drive:

dir <Folder Name> /AD /s
share|improve this answer
/A- Displays files with specified attributes. D-May the attribute be Directories /s - Displays files in specified directory and all subdirectories. – nanospeck Jun 26 '14 at 2:15
Is it possible to extend this search to hidden subfolders as well? – Luke Nov 10 '15 at 22:16
  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.

share|improve this answer
Thanks very much for all the info and rolling edits =) – BlackSheep May 23 '12 at 20:07
np, maybe worth an upvote? ;) – wullxz May 23 '12 at 20:19
Definitely worth it, but my rep isn't high enough on this sub-SOF hahaha – BlackSheep May 23 '12 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .