Use Command Prompt in Windows 10 or 7 to Create a Text File List of Filenames from a Specific Folder

2.9285714285714 1 1 1 1 1 1 1 1 1 1 Rating 2.93 (7 Votes)

There are times when you need to get a list of all the filenames that are in a particular folder.  You could type them all out one by one in a text file or excel spreadsheet.   However, when the folder is extremely large and has a lot of files in it, this can be a bit more cumbersome.  In this guide, I will show you how to use the Command Prompt to spit out a Text File which will contain a list of all the filenames contained in a specific folder. (Note: This Guide can actually be used in any version of Windows)


In order to start, you first need to know where your folder is located.  For this example, my folder is located in C:\Listing

CreateTextFileFromCMD 1

As you can see, I have a bunch of Photos in this folder and I want to print out a list of the filenames.

In order to do this

Click Start and in the Search Field Type cmd

CreateTextFileFromCMD 2

When it comes up, you need to type the following:

dir /s “C:\Listing” > “C:\Listing\Listing.txt”

  • The dir is the directory command.
  • The /s tells it to include all  subdirectories (subfolders)
  • The “C:\Listing” is the location of the folder you are wanting (change this to whatever you r folder location is, for example, if your folder is in “C:\Users\Betty\My Pictures\Kid Photos”  you would use that instead .  Note: Make sure to use the Quotations around you this path, it will be necessary if you have any spaces in your folder location
  • The “C:\Listing\Listing.txt” is the location you want the text file to put placed  (change this to wherever you want to place the text file)

CreateTextFileFromCMD 3


Hit Enter and it will just go to another line (and appear like it didn’t do anything – but it did)


CreateTextFileFromCMD 4

Now navigate to the location in Windows:

There it is:


CreateTextFileFromCMD 5

Now you can open it (or if you want to manipulate it some more, open it in Excel)

CreateTextFileFromCMD 6