Print List of Drive or Folder Content in Windows 7 Command Prompt

Posted by Tanmay

Keeping a hard copy of your important files and folder names for managing them in later is always a good convenience. Printing all the files, folders and sub folders name under a drive or a folder you can manage them easily. Any body can easily map your files and folder locations from the printed copy even if he is using your computer first time.

[ You might also like to read How to customize Windows Command Prompt to make User Friendly]

It is long time to use Windows. But starting from the previous version of Windows there is no such convenient way to print the list of the content of any folder or drive. Having said that Microsoft has failed to give importance in such small but useful requirements. There are thousand workarounds to do so but here is the simplest one.

How to print the drive or folder content

1. Using screen capture utilities

You can capture the image of the folder content using some screen capture utilities or directly using Microsoft Paint. But this is not convenient to use for the following reasons:

i> Capturing the image and then saving that in several format using image capture software or paint is a long way to go.

ii> You can not print the folder or drive content along with sub folder content. If you want so then you have to open each sub folders and then take a screen shot.

2. Using Command Prompt to print the content automatically

If you are using Windows 7 then you can print the folder content automatically by a simple dos command. Firstly, you have to have the privilege of accessing  the folders that you want to print the content of. But it wise to log-in as administrator in your Windows and run the command prompt as “Administrator”. For this purpose, type “cmd” in the start menu search box > right click on “cmd” > select “Run as administrator”.

Windows 7 will ask if you want to run the command prompt as administrator. Simply click on “Yes”. Now navigate to the location of which you want to print the content by typing the following command

cd <folder name>

For instance if you want to print the content of E:\>Zensar the command should look like this

e:
cd zensar

Now type the following command

dir > contents.txt 

This will list out all the files and folders name of  “Zensar” in the file contents.txt residing in the same folder(Zensar).

Now open the contents.txt file and see that all the files and folders name are listed there. But by this command Widows 7 only lists out the main folder names. The sub folders are not listed here.

If you want to print all the files, folders and sub folders then type the following command

dir <folder or drive path of which you want toprint> /s
 > <destination location of the list>filelist.txt

For instance if you want to print the content of E: drive and keep the list in the folder named “Documents” under F: drive then the command should

dir e:\ /s > f:\documents\filelist.txt

The /s switch tells to print the sub folder names.

If  you know any other procedure then feel free to share with us.

Related: Copy and Paste Files by Robocopy in Windows 7.

This post was written by Tanmay

Reader Comments

  1. I didn’t know about them …… thanks for sharing.

  2. This is old school trick but still very useful. Thanks for sharing it with us.

  3. anders

    if I use Filelist or contents.txt I get this messsage:
    “contents.txt is not reconized as an internal or external command,
    operale program or batch file” on all drives/folders.

    I have tried to use this also:
    go to the drive or folder you want in Command promt
    type
    DIR
    file.txt
    This one works on two of the drives, Notepad opens with the content of the drive/folder.
    It works on drive C: and G:. on F: end E: I get I get this message:

    “file.txt is not reconized as an internal or external command,
    operable program or batch file”

    I have 4 harddrives
    C: and D: is one dics
    E:,F:and G: are 3 different hardiscs.

    I use WIn 7 Ultimate 32bit.
    all discs have same security settings, and I am logged in as administrator.

    anyone have any good ideas?

    Have a nice weekend!!