How to easily copy all names of files in a folder in Windows [Guide]

If you need to copy a list of files from a folder in Windows there’s a better way to do that than copying and pasting each of the file titles. Instead you can set up a Notepad text document with all the file titles in a folder from the Command Prompt.

Firstly, open the Command Prompt by entering cmd in the Windows Start menu search box. Alternatively, press the Windows key + R to open Run; and then enter cmd.exe. That should then open the Command Prompt window in the shot below.

file list

There you should go to the folder directory that includes the files to copy. To switch directories in the Command Prompt, enter CD followed by the folder titles. For example, to open the Windows folder you would enter CD\Windows.

file list2
Once you’ve found the folder with the files in it, you should then enter the following: dir /b >filename.txt. Note that the filename is the title of the text document that will include the list of files. As such, you can change filename to any other alternative document tile; but enter the rest of the command line exactly the same as below.

file list3

Then press Enter to set up the text document. Open Windows Explorer, and go to the folder that you copied the file titles from. You should now find that it includes a new text file with a list of all the files in the folder as below.

file list4

Now you can copy a variety of folder file lists much the same. They include both the file titles and formats, but little else. Those lists can be copied from Notepad into alternative software packages with which you can add line numbering, bullet points, etc if required.

Related Posts

  • Eswarkumar

    Thank you

  • Mohit Handa

    This works

  • Paul

    Hi. I’m going around in circles looking for an answer. I hope you can help.

    I am a photographer. I have a folder of RAW files with generic file names from the camera. I have edited over 200 and saved as jpeg, then renamed each file individually. I need to re-edit the RAW files, but copy the jpeg file names to the RAW files folder.

    Can you help me?


  • Roberto Reis

    Thank you very much, helped a lot!

  • tony

    easier to use Firefox, but if want to stick with command promp:
    1/ from windows explorer, roam to the folder that you want contents to be copied
    2/ SHIFT and Right click on that folder, then pick “open command window here” from context menu
    3/ ….>dir /B >filename.txt then enter

  • Col. Panek

    I’m sure there’s more tricks than just a listing, but I forgot how they work in Windows. In Linux, you have dozens of options for the DIR command for sorting and formatting; see them by typing “man dir”. For instance, “dir -h -l” gives you a nice list of the file names, their sizes, permissions, and owner. You can send it to a text file, but it’s just as easy to copy and paste from the terminal to a text editor,

  • David Rodper

    Excellent reminder that DOS had neat tricks long time ago. I would add to this article that a Bat compiler could make this a file that could be used anywhere and given to friends who may not know how to do all these tricks we know.

    Keep them coming. You are invincible.