Home » Questions » Computers [ Ask a new question ]

List all files in all subfolders

List all files in all subfolders

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

Asked by: Guest | Views: 22
Total answers/comments: 3
Guest [Entry]

"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"
Guest [Entry]

"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)."
Guest [Entry]

"dir /s /w >files.txt will get you most of the way there. It will keep the extensions. Then open files.txt in a text editor and either

sort all the lines and delete the superfluous ones
or remove them with a find and replace operation or 2.

The regex ^ +\d+ File.+\r\n\r\n Dir.+\r\n\r\n got rid of the gaps and folder details between the individual folder files listings for me in Notepad++.

Then just trim the top & tail of the text file."