Sometimes we need to see a list of files or subfolders inside a folder. For a couple of files, we can just open up a text editor and type the filenames. But for a long list of files, and if there are also subfolders containing more files, the job becomes tedious, boring and sometimes impossible.
slide 1 of 6
Printing List of Files in a Folder – The Command Line
The easiest way to print a list of files in a folder is using the command line. You can access the command line by clicking the Start button (the Windows Orb), clicking Run (if you do not see “Run" in your start menu, right-click the Windows Orb, select Properties, switch to the Start Menu tab, click Customize, scroll down and tick the “Run command" option), and typing cmd and hitting the Enter (Return) key.
In the command prompt screen, you will see the current working directory, which is something like C:\Documents and Settings\Your_User_Name. We will then switch to the directory that we want to retrieve the list of files. We will use the cd (change directory) command to navigate to the folder.
For example, suppose that we want to retrieve the list of files in the Downloads folder. To switch to the folder, we will simply issue cd Downloads command (tip: you can type the first or first two letters of the folder and hit the Tab key to autocomplete). To retrieve the list of files, simply issue the dir (directory) command and direct the output of the command to a text file. Following our example, the command will be dir /o > downloads.txt. Windows will list the files and subfolders in the Downloads directory, sort the list by directories first and then by name, write them in a text file and save the text file in the current working directory (which is Downloads in our case) with the downloads.txt name.
You can then double click and open the downloads.txt file. In my computer, the file is as follows:
(Click any image for a larger view.)
slide 2 of 6
slide 3 of 6
If we want to print the list of files in the subdirectories, the command will be dir /o /s > downloads.txt. The output will be similar to the following:
slide 4 of 6
slide 5 of 6
To see the additional options for the dir command, such as listing files by their attributes (system, hidden, read-only), you can check the additional options by dir /? command.
slide 6 of 6
Printing List of Files in a Folder – The Graphical Way
The reason why I don’t prefer a software alternative is to avoid installing additional programs when I can do the same with the built-in tools. If you want to avoid the command line and use a graphical tool instead there are a couple of programs you can find online.
The first program that you can use is the Dir Print. The program can show/hide files depending on the file attributes (system, hidden, read-only), icon files, but not the folders in the current directory in the current release. You can also export the view with the Print button.
Another more sophisticated program is Directory Print from Ashisoft, which gives you more options such as displaying and printing treeviews with files size, listing only folder names, customizing the list, excluding certain files, folders and extensions and saving the outputs as HTML or Rich Text Format.