Printing a directory listing is something you may not do often, but when you need to print a listing of a directory with a lot of files in it, you would rather not manually type the filenames.
You may want to print a directory listing of your videos, music, ebooks, or other media. Or, someone at work may ask you for a list of test case files you have created for the software you’re developing, or a list of chapter files for the user guide, etc. If the list of files is small, writing it down or manually typing it out is not a problem. However, if you have a lot of files, automatically creating a directory listing would get the task done quickly and easily.
This article shows you how to write a directory listing to a file using the command line and how to use a free tool to print or save a directory listing in Windows Explorer.
Using the Command Line
Printing or saving a directory listing using the command line is an easy, straightforward process. First, there is an easy way to open a command window to a specific directory. In Windows Explorer, navigate to the directory for which you want to print or save the listing. Press the Shift key while right-clicking on the directory. Select Open command window here from the popup menu.
At the command prompt, type the following command and press Enter.
dir > print.txt
A file called print.txt is created in the directory.
When you open the file in Notepad, or in your favorite text editor or word processor, you will see the same directory listing you would see in the command window using the “dir” command alone.
If you want just a list of the filenames, you can run:
dir /b > print.txt
Using a Free Tool
There is an easy way to print and save directory listings using a free tool. Directory List & Print allows you to generate directory listings that can be customized, saved as files, and printed.
NOTE: There is a Freeware version and a Pro version of Directory List & Print. There are features in the program that are grayed out in the Freeware version unless you purchase the Pro version for $20. However, the Freeware version still provides plenty of flexibility for generating directory listings you can print or save.
Directory List & Print is a portable program that does not need to be installed. Simply extract the downloaded .zip file (see the link a the end of the article) and run the .exe file.
One especially handy feature of Directory List & Print is the ability to add an option to the Explorer directory context menu for directories. This allows you to quickly generate a listing for a directory from within Explorer. To do this, you must run the program as administrator. Right-click on the .exe file and select Run as administrator from the popup menu.
When the program opens, select Add to Directory Context Menu from the Setup menu.
An Information dialog box displays saying that the option has been added to the context menu.
To generate a listing of a directory, right-click on a directory in Windows Explorer and select Open in Directory List + Print from the popup menu.
The program opens and a listing of the selected directory displays in the text box at the bottom of the window that is always visible no matter which tab is active at the top of the window. The Directory tab displays allowing you to manually select a directory and to set up Favorites, or directories for which you might generate listings often. Some common system directories have already been added to Favorites for easy access.
The Selection tab allows you to specify what is displayed in the directory listing, such as the date, time, and size.
The Output tab allows you to send the listing directory to a printer or copy the listing to the clipboard for pasting into any text editor, word processor, or other program that accepts plain text. You can also open the listing directory in Word or Excel from within Directory List & Print.
For example, here’s a directory listing of .mp3 files in Excel. The columns are automatically placed into columns in the spreadsheet.
We also copied the listing to the clipboard and pasted it into Notepad. The columns are appropriately spaced like a table.
Because Directory List & Print is not installed, there is no shortcut for the program on the desktop. You can add one using the standard Windows method, or you can easily add a shortcut to the desktop from within the program. Simply select Add Program Shortcut to the Desktop from the Setup menu.
If you want a listing of a directory on a network drive, use the Network Drive options on the Setup menu in Directory List & Print. You can also drag and drop a directory from Windows Explorer onto the program window to quickly generate a listing of that directory.
Download Directory List & Print from http://www.infonautics.ch/directorylistprint/.