**Disclosure: This post contains affiliate links. If you make a purchase through these links, we may earn a small commission at no extra cost to you.
If you are like most people, you have created many files and folders on your computer, and sometimes it can get a little tough trying to manage all these files and folders. There may even be a time when you want to print or export the folder contents from your computer. Even though Windows doesn’t have a built in tool to do this, it’s still possible to accomplish this without using a 3rd party app to do so.
In this article, we will be showing you several commands you can use to print or export folder contents in Windows so you can choose the method that works the best for you.
The image below shows the Documents folder that we want to print out or export to a file. As you can see, there are many files as well as several folders.
The first step in the process involves opening a command prompt and then browsing to the folder that you want to print or export the folder contents of. If you want to add a right click open admin command prompt context menu item to Windows, check out this video.
Now that we are in the Documents folder, we will run the first command which will export the directory contents to a text file that we can then save or print out. You can change the name List to anything you like but be sure to leave the .txt extension so you can open it with Notepad.
dir > List.txt
After you run the command, you will not receive any confirmation that it was successful from the command prompt. But rather it will just go back to the same prompt as where you started.
You will then see your text file in the same directory you printed and can then double click it to open it or even print it.
You will see that any items that are folders will have <DIR> in front of them. It will also list the date, time and file size in the exported file. At the top of the text file, you will see the path to the directory you have exported the folder contents for.
If you would rather have a listing of the file and folder names that shows their entire path, you can use the command shown below.
dir /a /s /b > List2.txt
Here are what the switches in the command will do to for the results.
- /a – Displays all files, including hidden and system files.
- /s – Searches all subdirectories, listing files and folders recursively.
- /b – Uses bare format, displaying only file/folder names without extra details (like size or date).
This will just list the file names, but you will be able to see what folder they are in as well.
The next command we will use the tree command to get a different view of our files and folders. The tree command displays the directory structure in a hierarchical tree format.
tree >List3.txt
As you can see from the results, it shows each folder along with its subfolders underneath them.
For our last method to print or export folder contents in Windows, we will be using the Copy as path feature of File Explorer. To do this, simply select all or however many files and folders you want to print or export. You can press Ctrl-A on your keyboard to select all the files and subfolders in the directory. Then you can right click on any of the files and choose Copy as path.
Then you can open Notepad, WordPad, Word or any other text editor you wish to use and paste it into it.
As you can see in the image below, the folder content list was formatted based on the order of the files in File Explorer with the List 1, 2 & 3 text files on top.
We will now sort the files and folders by name and repeat the process.
As you can see, the results match the order of the files and folders when we paste it into Notepad once again.
For additional training resources, check out our online IT training courses.
Check out our extensive IT book series.