Mobile Number Tracker
Trace Mobile Number Earn Money Online

Make the List of All File Names in a Folder

Samyak Lalit | December 11, 2013 (Last update: November 10, 2014)

Samyak Lalit is an Indian author and disability rights activist. He is the principal author and founder of projects like TechWelkin, WeCapable, Viklangta, Kavita Kosh among many others.

Although Windows operating system is not as powerful as UNIX/Linux when it comes to do non-conventional tasks –but still some of these not often performed tasks could be done on Windows.

One of such, rather uncommon, requirement arises when you need to create a list of all file names present in a folder / directory. The other day, I wanted to send my friend a list of songs that I have in the music folder in my computer. Creating such a list is very simple but there is no straightforward way to do this. Lets see how to go about it.

Open Windows Explorer and navigate to the folder whose content you want to list. Once you’ve opened this folder and are able to see its content – click on the location bar (where you see the path of your current folder) and press CTRL + C to copy the location path of your folder.

Go to Start button and type cmd in the “Search programs and files” box (If you are using Windows XP, click on Run option and type cmd in the resulting box). Press Enter.

A window with black background will appear on screen. This window is called Command Prompt. Don’t get afraid of the geeky look of this window –it is pretty harmless and easy to handle.

Type the following in the command window:

dir /s/w “

Now take right click anywhere inside the command window and select paste option from popup menu. This will paste the location of your folder that you had just copied.

Now close the double quote. By now the command will look something like:

dir /s/w “C:\mystuff\music”

To this add the following

> C:\mylist.txt

The command is complete now. Your final command should look like:

dir /s/w “C:\mystuff\music” > C:\mylist.txt

Press enter to execute the command and that’s it!

Go back to Windows Explorer and navigate to C:\ directory. Here you’ll find a new file called mylist.txt

Open this file and you’ll find the list of files.

READ ALSO: Perl code for creating list of files present in a folder

I hope this small tip will save you a lot of time. Let me know if you have any questions regarding it. Do subscribe to my newsletter to keep getting such tip.


Leave a Reply

Your email address will not be published. Required fields are marked *