How To Easily Save Or Print A Directory’s Contents [Windows]


It may happen that you need a directory listing, that is a list of all the files in a folder. Unfortunately, there is no direct way to do this simple task in Windows.

Say you need to send a list of all the files found in a directory to a friend. You could take a screen-capture of the folder and send it to them. What if there are lots of files? You’d have multiple screen-captures and files will repeat in various captures. Not very elegant. So I’ll show you 3 methods to get a list of all files from a directory and save it as a text file.

1. Using Command Prompt

In my opinion, this is the simplest of the 3 methods. It’s portable since it uses in-built Windows tools. As the title says, we’ll be using the Command Prompt. No need to worry if you have no experience with command line interfaces. The commands are easy to understand and there are only a few. I’ll be using Windows 7 for this post, but it should work for all version of Windows, especially XP and after.

  1. Open the folder which contains the files you want to list.
  2. While holding down the Shift key, right-click in an empty space and select “Open Command Window Here
  3. A Command Prompt window will open. It usually has a black color, and you will see something like this by default: “C:\Users\your username>
  4. Type “dir /b > mylist.txt” then press Enter
    • The “/B” part means “bare”. It will only print the file names, while skipping all the attributes, file sizes etc. This is usually what you want.
    • The “>” sign means: “take whatever output the previous command produces and put it in the file that follows. Create that file if needed.”
    • You can try various options. Try viewing help first: “dir /?
    • If you want to sort, add the “/O<x>” switch (slash-Oh) where <x> is: E – extensions, S – file size, G – group by directories. E.g. “dir /B /OG > mylist.txt
    • If you want all file sizes etc… remove the “/B“: “dir > mylist.txt
    • If you want to include files found in sub-folders too: “dir /B /S > mylist.txt
  5. After that, you’ll find a file called “mylist.txt” inside that directory which will contain all the filenames of files found in that directory. You can then open that file in Notepad to print it, or send it to a friend or whatever you wanted to do with the list of files.

2. Use File List

Alternatively, you can make use of the very simple utility called File List.

Just drag the folder which contains the files you want to list over the application. It’ll generate a list of files which you can then copy and paste, wherever you need.

To print the output, open Notepad, paste the contents inside and then Print.

You can also use the “…” button to browse to your required folder.

One thing I didn’t find in that application is the ability to list files in sub-folders. So you’ll have to do that manually: List each folder, copy and collate their outputs manually.

3. Use Karen’s Directory Printer

If simple is not good for you, try a heavyweight app when it comes to listing files: Karen’s Directory Printer.

It has tons of features and really customizable. You can list files on network shares, local files and files in subfolders. You can select to show files by attribute and decide how you want the files sorted. The greatest feature of it is to output file attributes such as date created along with names. After selecting what you want, you can customize the output it generates to some extent. Overall, it offers lots of customizations.

I found that it provided everything I wanted when it came to listing files. It hasn’t been updated since November 2009 (at the time of writing) but that shouldn’t be a problem since it runs fine on Windows 7.

My only complaint is that its user interface takes some time to get used to.

Whatever tool you choose, they’ll all provide you with a list of files at the end. Up to you to decide what to do with it.

That’s it for this post. If you use some other tool to do the same job, you can share it with the world in the comments below. Thanks for reading!

  • Strangely, enough us old guys raised on DOS still have a few tricks up our sleeves. Using the pipeline > command to send info to a file is just one of them. The other useful trick that I still occasionally use is building a batch file to run several commands at once.

  • InF

    I absolutely love batch/script files for their ability to do repetitive tasks easily. Have a couple of ones that I make use of and I may dedicate a blog post to them someday in the future. 🙂

  • binaryman

    I use Directory Report
    It can print many more attributes than the DOS dir command