Get a listing of files within a folder quickly

Submitted by Joshua Wilkins, EMSL web author

If you are working with folders and need a list of the contents within, it can be a nightmare to transcribe them one at a time. There is a better way to do this within Windows, and I will show you two ways- one automatic but less configurable, and a manual, command line version that is more customizable.

The automatic version is pretty simple. Just download this file from Box and place it in the folder with the files you want a list of. Run the file by double-clicking on it and it will create a new file called “directoryListResults.txt” which contains the plaintext list of all the file names. Tada!

  1. The manual method is almost as easy, but has some more options if you need more info. Open the folder containing the files you want to list, hold shift and right-click in the folder.
  2. Click on “Open Command Window Here”.
  3. In the black window that appears, type “dir > output.txt”. This will create a complete listing of files and folders in the folder you selected and will send that information to a file called “output.txt”

From this point you can change the command to generate whatever format you need. The txt file can be named anything as long as it ends in .txt and follows Windows naming rules. Some examples:

  •  “dir /s/b > foldersandfiles.txt”
    Outputs not only files but subfolders too with all of their files and folders in the text file called foldersandfiles.txt. This could produce a really long list if you have a lot of subfolders.
  • “dir > completelist.txt”
    Outputs a full listing of the directory for your folder, including time it was last modified, file size, and total file size (in bytes), outputted to the text file completelist.txt
  • “dir /od > whatevername.txt”
    You can sort your files when you list them too. Using the /od modifier will sort them by modified date with the newest at the bottom. If you use /o-d it will sort them with the newest modified date at the top of the list. This will output the results to the text file whatevername.txt

If you want to read more about what you can do with this and how it works, go to