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

In windows, is there any way to get a list of all files in a folder, including all the files within all the subfolders?

share|improve this question
up vote 22 down vote accepted

List all Files Recursively

C:\>dir /s

To save them to a file

C:\>dir /s /b>filelist.txt

View them a page at a time

C:\>dir /s | more

share|improve this answer
Well, okay... This will work too. Just wondering why no one uses the standard Search function of Windows for this. :-) – Wim ten Brink Aug 31 '09 at 10:03
@Workshop Alex: Because 1) recursive dir is just a little bit faster if it doesn't have to check any conditions; 2) it lets you save the names into a file. – grawity Jan 26 '11 at 11:01
@WimtenBrink: and how are you going to send windows search to another user? – adolf garlic Jun 26 '12 at 8:53
You dont need to pipe to more, you just need the /p switch (does the same thing) – Keltari May 1 '13 at 18:37
Remember the /a switch to include hidden files – Canadian Luke May 8 '13 at 5:01

Try tree /f. This should output the entire structure.

share|improve this answer
Which will be displayed as a tree, not a list. – Joey Aug 31 '09 at 8:29
You don't think the OP would consider that result a list? – hyperslug Aug 31 '09 at 8:59
I thought the tree command would have the best formatting, allowing you to clearly see the level of the subfolders. – alex Aug 31 '09 at 9:25

You will get UnixUtils at sourceforge, that will give you find.exe.

You can then do the following for list of all files with folder paths.

cd Path\to\folder
find.exe . -type f

There are other forms of the Unix command that may be useful for you.
The output is more search-able compared to the native dir and tree commands.

Updated with input from Johannes.
In the cmd.exe shell

dir /b /s

works quite well for a recursive listing in the Widows formatted form,
(so you see "C:\" and the reverse slashes, '\').
I completely missed the "\b" in Nifle's answer! (+1 for that now).

share|improve this answer
No need to install anything here, as dir is perfectly capable of this. – Joey Aug 31 '09 at 8:30
@Johannes, have you compared a Unix find output with a DOS dir /s or tree for that matter? – nik Aug 31 '09 at 9:36
Have you ever used dir /b? :-) – Joey Sep 2 '09 at 5:13
@Johannes, actually I cannot remember if I did that in the DOS 6.22 days. Got more used to find and with Cygwin, never tried the dos commands (actually took me a moment to open cmd shell and avoid /usr/bin/dir to try that option. But, it does work; glad to learn that :-) – nik Sep 2 '09 at 6:27

Why so complex? Press Windowskey+F to start the "File Search" in Windows. On the left, go to "Look in" and select the option at the bottom called "Browse...". Select the (sub)folder where you want to search in. Enter "*" (without the quotes) in the "All or part of the file name" editbox and start the search. Get some coffee when you're searching on a big disk with lots of data and just wait for this explorer-based search engine to show you a complete list. You can search it, open files directly and even narrow your search if need be.

Why do people forget this default search behaviour of Windows?

share|improve this answer
because it is not 1337? :-) – Natrium Aug 31 '09 at 13:14
You would have a hard time getting that in a text file, for example. – Joey Sep 2 '09 at 5:14
True, but why would someone wants it in a text file? :-) – Wim ten Brink Sep 2 '09 at 7:30
Note that this will (on Win XP at least) search all ZIP files in all subfolders as well. Which will be horribly slow. Which probably isn't what you want. Which can't be easily switched off. If there are no ZIP files, I agree that this is the best approach. – Martin Jan 26 '11 at 9:49
@Wim: Your 5-step process (Win+F, Browse, Subfolder, *, Start) is much slower than just typing "dir/s" (for a typist who types over 100 words per minute, and is used to doing stuff at a command prompt, so it is frequently pre-opened). Also, the process you mention has changed w/ Windows versions, while "dir/s" has been consistent. Also, your process requires pressing Win+F, which isn't always easy. Sometimes, even if a keyboard has the Windows key, that key may be more difficult to use, such as in Remote Access scenarios where the key might be used by the local computer instead of the remote – TOOGAM Oct 3 '15 at 13:06

You must log in to answer this question.

protected by Community Jun 2 '13 at 2:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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