Monday, June 13, 2011

List contents of a folder in Windows PC as text file

Sometimes you want to list and document all the files in a directory to a text file; for example, hundreds of mp3 files, thousands of pdf e-books or android apps apk cluttered in a folder. It is helpful if we need to keep an electronic record or to print and save the document as hard copy.

Linux does it with ls command in bash terminal.
'ls > directory_content_list.txt' will give the content of the directory in a text file 'directory_content_list.txt'

Now I wanted to list a directory in Windows.  An impressive software which would do this and much more is Karen's Directory Printer

If you don't want to install any program, there is one way to do it with DOS commands, but just by a few mouse clicks. The method is explained here very well.

Simply put, create a text file using notepad with the content below, save it as 'run.bat' file and run (double click) it. A DOS command window will pop up and the files will be created on your desktop, then opened in notepad. Remember to replace 'USER_WINDOWS_LOGIN_NAME' with your windows login name.

dir /a /b /-p /o:gen >C:\Users\USER_WINDOWS_LOGIN_NAME\Desktop\directory_content_list.txt
start notepad C:\Users\


  1. Directory Report is an impressive program to List contents of a folder in Windows
    It can print more attributes than DOS and
    it can save output in many formats

  2. @binaryman: Thanks for the info. That looks like a useful tool with good user/editor rating at CNET. But the one I mentioned here is free and would be sufficient for majority of purposes.