In windows, is there any way to get a list of all files in a folder, including all the files within all the subfolders?
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
Updated with input from
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 "
Nifle's answer! (+1 for that now).
I find this batch file every useful
@ECHO OFF SET targetPath="%~1" SET ToolPath=%~dp0 dir %targetPath% /b /s /a-d > "%ToolPath%list.txt"
Usage: Just drag the folder and drop it on the file DragDropListFile.bat, then a file called list.txt, which contains what you want, is created.
If you don't like drag & drop, try this batch file
ECHO OFF SET crtPath=%~dp0 dir "%crtPath%" /b /s /a-d > list.txt
Usage: put the file ListFile.bat in the folder you want to list files, then run the file ListFile.bat, then a file called list.txt, which contains what you want, is created.
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?
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\ngot rid of the gaps and folder details between the individual folder files listings for me in Notepad++.
- The regex
- Then just trim the top & tail of the text file.