Wednesday, March 25, 2015

How to Print or Save a Directory Listing to a File

How to Print or Save a Directory Listing to a File: How to Print or Save a Directory Listing to a File

00_printable_directory_listing

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.

01_opening_command_window

At the command prompt, type the following command and press Enter.

dir > print.txt

02_typing_dir_command

A file called print.txt is created in the directory.