Create a List of File Names in a Folder

The first and easiest way to create a list of file names in a folder is to use the command prompt. We can just use the DIR command to export a list of file names to a text document. To start, navigate to the folder with the files you want to create a list. Now, “Shift + right-click” in the folder, and then select the option “Open command prompt here.”

The above action will open the Command Prompt in the current folder. Now, copy and execute the below command: As soon as you execute the command, a new text file will be created in the current folder with the list of files in the folder. The good thing about the above command is that it will only list files and ignores any directories or folders. If you want the command to list directories or folders, use the below command: As you can see from the above command, we just modified the previous command and removed the -d attribute to include folders in the list. In case you are wondering, the /o:n switch ensures that the list is automatically sorted by names.

Add Copy File List Option to Right-Click Context Menu

If you need to create file lists often, then the above method may not be that user-friendly. To make things easier, you can add a context menu option which copies the file list. You can, in turn, paste the list wherever you want. To start, search for “regedit” in the Start menu and open it.

The above action will open the Windows Registry Editor. Here, navigate to the following location:

Right-click on the “Shell” key, and select the option “New -> Key.”

Name the new key “copylist,” and press the Enter button.

By default, all the new keys will have a String Value called “(Default)” with no value data. To change the value data, double-click on the value, enter the Value Data as “Copy file list,” and click on the “OK” button. This value is what you will see in the right-click context menu. Feel free to customize the text if needed.

Now, right-click on the “copylist” key, select “New” and then “Key.”

Enter “command” as the name of the key.

Again, the new key will have its own default value. To edit the value data, double-click on the Default value to open the “Edit Value Data” window. Here, enter cmd /c dir “%1” /b /a:-d /o:n | clip, and click on the “OK” button to save the changes. Note: if you also want to list folders along with files in a folder, then replace /a:-d with /a.

From this point forward, you can copy the file list by simply right-clicking on the folder that contains all your files and then selecting the option “Copy file list.” Once copied, you can paste the list whereever you want, like in a Notepad or Excel sheet.

Do comment below sharing your thoughts and experiences about using the above method to create or copy the list of files in a folder.