How to Copy a Folder’s File List in Windows

It may not be that often, but you may sometimes need to get the list of files in a folder. There may be several reasons such as to create a list of file names, copy all the file names, export a list of file names to excel, etc. No matter what the reason is, Windows has no default option to create a list of all the filenames in a folder. However, listing file names in a folder is not that hard in Windows. Here is how to create or copy a folder’s file list in Windows.

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.”

create-file-list-windows-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.

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.

create-file-list-windows-regedit

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

create-file-list-windows-navigate-to-key

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

create-file-list-windows-new-key-1

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

create-file-list-windows-copylist-key

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.

create-file-list-windows-copy-file-list

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

create-file-list-windows-new-key-2

Enter “command” as the name of the key.

create-file-list-windows-command-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.

create-file-list-windows-enter-command

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.

create-file-list-windows-copy-file-list-option

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

6 comments

  1. Let me see if I get this. You’re having people do a RegEdit rather than just creating a simple .bat file?

  2. There is a screen capture program I’ve used for years called FastStone Capture. One of the options is “Capture Scrolling Window.” Using that command, I am able to capture a list of folders, files, date modified, file type, file size, and other columns I have displayed in the window, no matter how long the list is. I can then save that screen capture as a pdf file or one of seven other file formats. If I save it as a pdf file, it automatically creates however many letter-size pages are needed for the length of the screen capture. While the file is not in an editable text format, it works if, for whatever reason, I just need a list of folders and files and any other details.

  3. I followed this to the letter and all I get if I do “Copy file list” on, say, my Downloads directory (from within my user directory) and then paste into Notepad, is the last thing that was on my clipboard. I’m running Ditto from my System Tray, though. Could that be what’s stopping it from working?

  4. Aha! I just found out why it wouldn’t work. The command appears to end in a comma (just after the word clip). This should be part of the main text, and not part of the command.

  5. It would have been way simpler to just post a link to a *.reg file. The instructions were clear and easy to follow. But, some people might not be so savvy regarding editing registry. We all know editing the registry can be very hazardous by people who don’t know what they are doing. Here’s an easy way to create a reg file without uploading the file. Open notepad. Copy the text between the brackets into Notepad:

    Save as file type: any file and call it Copy file list.reg.
    Right click on this new file, select Merge. Voilà! All done

Comments are closed.

Sponsored Stories