How To Get All Files and Folder Names Into a Text File?

Finding and organizing all your files on your computer can be daunting. It often requires reviewing numerous file folders before finding what you seek. This is why having an easy way to get all the names of your files and folders into one place is essential. This article will explain how to get all files and folder names in a text file on Windows, which makes locating these much easier later on down the line.

How To Get All Files and Folder Names Into a Text File?

How To Get All Files and Folders Name Into a Text File?

In this section. We’ll be going over three methods to get all files and folders’ names into a text file; one of these methods does not deal with a text file, but it is worth knowing. Here is all that is covered:

  1. Using Windows Terminal
  2. Using Microsoft Excel
  3. Copy File List to Clipboard

Let’s now have a detailed look at all of these methods.

1] Using Command Prompt

Command prompt is the pre-installed command line utility that has been used for a long time to execute commands in Windows to execute crucial commands, perform actions, and use tools that can otherwise be not used in the standard user interface. Here’s how to use it to get all files and folders names into a text file:

  • Right-click on the Start Menu, and click on the Windows Terminal (Admin)
  • Open the Windows file explorer, navigate to the directory from which you want the names of all the files and folders, and right-click it. Now, click on the copy as a path option.Copy folder as a path in Windows
  • Head back to the command prompt, type the following command, and press enter. (Replace the directory path with the path you copied in the previous speed)
Cd directory path 
  • Now, this will open the respective directory in the command prompt.Getting names of all files and folders into a text file using command prompt
  • Execute the following command to get the names of all the files and folders in a text file.
dir /b > alldata.txt

This will save a file named alldata.txt in the directory. Open the file to view the names of all the files and folders.Getting names of all files and folders into a text file

2] Using Microsoft Excel

This method is relatively straightforward. It does not require you to execute some specifically complex commands. Here are the steps:

  • Open the respective directory where you want the names of all files and folders.
  • Now, please select all of them and right-click the blue area. From the context menu, select the copy as a path option.Copy all files in folder as a path in Windows
  • After copying all the files as paths, open MS excel.
  • In Excel, press ctrl+v to paste all the file directories.Pasting all files and folder name in MS Excel
  • Now, press ctrl+f to open the find and replace the window once you do that. In the find box, fill in the initial part of the file path, excluding the directory.
  • For e.g.: If the file path is C:\Users\ojasv\Downloads\3.png, then, paste C:\Users\ojasv\Downloads\Find and replace in MS Excel
  • Leave the replace box empty and click on replace all. This will clear the directory location part of the path from each entry and leave you with just the file names.

3] Copy the File List to Clipboard

Windows do not allow copying the file list for a respective directory to the clipboard. But you can add the option to do so by making a few simple tweaks to the registry. Here’s how to do it:

  • Now, right-click the Shell folder from the left pane and create a new key named —copylist.Creating a new key in Windows registry
  • Now, open the copylist key, and double-click the default entry. Change the value data of the entry to Copy the file list to the clipboard.Changing value data for an entry in registry
  • Now, create a new key in the Shell directory named command.Creating a new key under a specific directory in registry
  • In the command key, double-click the default entry and change the value data to the following command: Changin the default value data for an entry in registry'
cmd /c dir "%1" /b /a:-d /o:n | clip
  • This will add the Copy file list to the clipboard option in the context menu. You can right-click a directory and copy the file list to the clipboard.


Well, this was all for our article on how to get all files and folder names into a text file in Windows. Having a few tricks to long and tedious tasks, like manually typing each file name, greatly benefits your productivity and workflow. If you found the article, please make sure that you share it with everyone.


  1. I typed in a complete list of folders I want to a text file. I thought it would be easy to copy & paste the text to make a Windows Folder. Nope. Spent 2 days searching for the method. I copy the list, but then when I go to Explorer it won’t paste. Any idea on how to do this?


Please enter your comment!
Please enter your name here