How to get all file names that are in a folder to a text file. [WINDOWS]

Sithum Meegahapola
1 min readSep 15, 2020

This article will show you how to get all file's names in a folder to a text file.

So for some scenarios users need to get all file names that are in a folder at once to copy-paste maybe? yeah, this is a difficult task if we have hundreds of files in a folder. so there is the small command to run in a terminal to get these names into a text file. so lest see what it is

  1. Open the command prompt in the folder that you need to get the file names.

2. Type this command in the command prompt.
dir /b > filenames.txt

yeah that it and it is simple as that. but be careful because in that text file you will the name of that .txt file as well. if you going to use the text file for some data reading or something remember to remove the .txt file name from the text file.

--

--