How to Print the Contents of Folder or Directory


If you want to make a list of all the contents of a directory, you’re going to have to find a much easier way than typing it all out. If it’s a multi-GB music directory, you’ll end up with aching fingers before you’re even halfway through. Thankfully, I’ve got an easier way. You can create a small batch file, and then add it to the right- click context menu, so that all you will have to do is right-click and select “Print Directory Contents” (or something like that). To do this..

 

First, open Notepad, and type in the following:

@echo off
dir %1 /o:g > c:\directory.txt
start /w notepad /p c:\directory.txt
del c:\directory.txt
exit

 

Save this in the root of the C drive as “print_directory.bat”. Now, in order to add this option to the right-click context menu, you will need to edit the default folder properties. In Windows Explorer, go to Tools > Folder Options > File Types. Click on the “File Folder” file type and then click on the Advanced button at the bottom right.

 

Now, click on the “New…” button. In the Action field, enter the name of the action, such as “Print Directory” or “Print Contents”, and in the “Application to be used to perform this action” field, fill in “C:\print_directory.bat”. Click OK thrice and then close to exit.

 

Before you do anything, check to see that if you double-click a folder it actually opens normally, because sometimes the Search function gets set as default. You really don’t want to have to right-click every folder and select Open. So let’s fix this first:

Open the Registry Editor and navigate to HKEY_CLASSES_ROOT\Directory\shell\. Edit the default value (which might have changed to “Open” or “Find”) and change it to “Explorer”.  Now make sure you can double-click and open folders again, and then you’re ready to test the Print Contents / Directory command you just made. Right-click on a directory and select “Print Directory” (or whatever you called it).

 

You will get a pop-up that will ask you where to save “directory.mdi”. This is the Microsoft Document Imaging format, which makes a nice, neat, and readable file that will list out the contents of the directory. Rename it to the name of the directory, and then save it. It will open with Microsoft Office Document Imaging.

Comments

Leave a Reply