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 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:
- Using Windows Terminal
- Using Microsoft Excel
- 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.
- 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.
- 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.
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.
- After copying all the files as paths, open MS excel.
- In Excel, press ctrl+v to paste all the file directories.
- 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\
- 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:
- Open Windows start and search for the registry editor and open it.
- In the registry editor, navigate to the following directory:
- Now, right-click the Shell folder from the left pane and create a new key named —copylist.
- 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.
- Now, create a new key in the Shell directory named command.
- In the command key, double-click the default entry and change the value data to the following command:
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.