Occasionally, you might want to print or save a list of the files in a directory. Windows doesn’t feature a simple way to do this from its interface, but it’s not too hard to accomplish.
Printing a directory listing is probably not something you’ll need to do often, but it can occasionally be useful. Maybe you just want a quick list to compare with another directory. Maybe you need to generate a printed list for some work reason. Or maybe you just want a saved list of your installed apps. Whatever your reasons, printing or saving a directory list isn’t too difficult. We’re going to show you a quick way to do it from the Command Prompt (or PowerShell), and a third-party tool that makes things a little easier if you have to do it often.
Print A Directory List By Using Windows PowerShell
Printing or saving a directory listing using PowerShell is an easy, straightforward process. First you need to open the Command Prompt and get to the directory for which you want to print the contents. You can do this in one of two ways.
The first (and easiest) is to right-click the folder and choose the “Open PowerShell Window Here” command from the context menu. If you already have a PowerShell window open, you could also just navigate to the folder using the
Note: This procedure works exactly the same way whether you use PowerShell or Command Prompt, so use whichever you feel most comfortable with.
At the prompt, type the following command (replacing “filename.txt” with whatever you want the resulting file to be named), and then press Enter:
dir > filename.txt
Windows creates a file in that same directory by whatever name you chose.
When you open the file in Notepad, or in your favorite text editor or word processor, you’ll see the same directory listing you would see had you just used the
dir command alone at the prompt.
If you prefer just a list of the filenames themselves, you can modify the previous command with the
cmd /r dir /b > filename.txt
cmd /r part of this command tells PowerShell to execute the command as typed and then exit. If you’re using the Command Prompt, you don’t need to add the
cmd /r part of this command and would just type
dir /b > filename.txt .
That command gives you a text file that looks more like this:
And one more little bonus tip. If you find yourself needing to create a file with directory listings often, we’ve written about a little hack that lets you copy a directory’s file list to your clipboard with just a right-click. That makes things a little more convenient, and also lets you paste the resulting file list into any type of document you want.
Print A Directory List Using a Third-Party Tool
If you don’t mind installing a third-party tool to get the job done, Directory List & Print makes things even easier by letting you generate directory listings that you can customize, save as files, or print.
The free version Directory List & Print will likely do everything you need, especially if you’re just looking for a way to print basic lists of files in single directories. If you need even more power, the Pro version ($22) adds the ability to include a huge number of metadata and Windows file properties, specify a recursion depth for subdirectories, provides additional sorting abilities, and more.
Directory List & Print is available as both an installable or a portable app, so choose whichever is right for you.
Using the app is reasonably straightforward. On the “Directory” tab, choose the directory for which you want to list the contents. You can choose from a hierarchical folder view or a list of favorite folders.
On the “Columns” tab, choose the columns you want displayed in your list on the left and click the “Add” button (the right arrow) to add those columns. Use the up and down arrows at left to adjust the positions of the columns. And click the “Create/Update File List” button at any time to see how your list is shaping up.
Choose any advanced options you want from the “Display” and “Filter” tabs (we’re going to send you to the app’s help files for details on those), and then, on the “Output” tab, choose how to generate your list. You can print it, copy it to the clipboard, or save it in a number of popular formats.
Another especially handy feature of Directory List & Print is that you can add an option to the context menu for folders, allowing you to quickly open that folder in the app. To do this, you must first run Directory List & Print as administrator. Right-click the .exe file and select the “Run as administrator” option.
After the app loads, open the “Setup” menu, and then choose the “Add to Directory Context Menu” option.
Now, to generate a quick listing, just right-click a folder and choose the “Open in Directory List + Print” command from the context menu.
You can also drag and drop a directory from Windows Explorer onto the program window to quickly generate a listing of that directory.
- › 20 of the Best Tips and Tricks for Getting the Most out of the Windows Command Line
- › How to Copy a Folder’s File List with a Right-Click
- › How to Use the DIR Command in Windows
- › What Do “FR” and “FRFR” Mean?
- › This Is How Steve Jobs Killed Adobe Flash
- › The Origins of Ctrl+C, Ctrl+V, Ctrl+X, and Ctrl+Z Explained
- › Logitech MX Mechanical Keyboard Review: Easy on the Eyes, Not the Fingertips
- › AMD’s Ryzen 7000 Series Are the First 5nm Desktop CPUs Ever