If you want a list of all your files in a certain directory in Windows, follow the following steps:
- Click the Start Button and type
Command Prompt
. - Open Command Prompt with administrator privileges. Either right-click on the icon and choose “Run as administrator” or click on “Run as administrator” on the search result options that will show up.
- If needed, change the drive by typing the drive letter followed by a colon (for example,
E:
) then press enter. For root directory, usecd\
instead. - Create a directory by typing
tree /f /a >
and filename of listing. For example,tree /f /a > myList.txt
if you want your txt file output to be in the same drive. Otherwise, specify the exact location like this:tree /f /a > C:\foldername\myList.txt
.
Explanation of the commands:
TREE
– Displays directory paths.
/A
– Specifies that alternative characters (plus signs, hyphens, and vertical bars) be used to draw the tree diagram so that it can be printed by printers that don`t support the line-drawing and box-drawing characters
/F
– Displays the names of the files found within each directory listed.
Depending on the quantity of files you have in your drive, it may take a while for the whole process to finish. The cursor will keep blinking while the process is ongoing. You can view your txt file now to see the list of all your files in that directory.