How to create a list of a folder’s content

The other day I needed to help my dad with something. He had burned an MP3 CD for my mom’s car, but the CD player couldn’t read them. Upon closer inspection, I realized that the tool he used to burn that CD had converted all his MP3s to MP4s, which is a video format. That was odd, but I didn’t investigate as to the reason why, because I had another task at hand: burning a new CD with the very same songs but with the correct format. My dad’s computer only has a single DVD drive, so I needed to create a list of its contents. Thankfully, every OS has a way to do this using the command line. It may not be immediately apparent, but an imaginative and somewhat experienced user can come up with this solution.

As you probably know, the DIR command is used to list the content of a folder. When you first open the Command Prompt, the active folder is your user’s home folder. Typing DIR will list its content, like this:

DIR in Windows is a very powerful tool that has other uses, but for this article will only focus on its ability to list the content of a folder. In my case, I wanted to create a list of the files inside a CD-ROM, so I could type the command DIR D: to do that.

What we did is self-explanatory: we told DIR to list the content of drive D:, but we still need to create a file. To do this, we can add > list.txt to the aforementioned command, like this.

Notice that the output wasn’t written to the command prompt. The > sign is what in IT parlance is known as a command redirection operator. Specifically, it tells the command processor to write the output of the previous command to a file named list.txt. If the file already exists, its contents will be replaced. If it doesn’t, it will be created and then the output will be written to it.

The file can be found in the active folder, in our case, C:\Users\Tech 4 Freelancers. To view it, we can type the command TYPE list.txt or open it in a text editor, like Notepad.

About Andrea Luciano Damico 137 Articles
Andrea Luciano Damico is a freelance translator from Italy. Among his interests are linguistics, technology, video games, and generally being a chill guy. He runs Let's and