Convert Windows Directory to HTML Listing

Ever need to create an HTML file that lists all the files and folders in a particular Windows directory? Probably not something you’ll need to do very often, but it does come in handy every once in a while.

For example, if you want to quickly create a list of all files and folders inside of a Window directory and send it to someone in a nice easy to view format. Earlier I had written about how you can use either the command line or third-party apps to print a list of all files and folders in a Windows directory, however, those options only output to text, Word or Excel.

DirHTML

DirHTML is a nifty program that pretty much does the same thing, generating a recursive list of files and folders, but outputs it as an HTML table with links! Therefore, you can actually click on any file to open the file in the web browser or with whatever the default application is for that file type. This could be very convenient for web developers working on a website locally.

Below is what a directory listing outputted in HTML looks like for the download folder on my computer. You’ll notice the output is a bit plain and kind of old-school looking. This is because the program is old and therefore the webpage it creates looks pretty old. If you want a fancier output for the directory listing, check out the second program called Snap2HTML that I mention below.

dirhtml

Across the top are anchors, which are links to all of the folders inside the directory you specified. After that, all files within the root folder and within each folder under the root are listed along with their basic file attributes. You can click on any of the files to open them.

Once you download the program, simply run the dirhtml.exe file and you’ll get a configuration window like this:

create directory listing

The program is highly configurable, but you can also just choose the folder and click the Build button if you don’t want to do anything else. You can filter based on file extension (File Specification) or by file names.

Under Miscellaneous, you can specify the file attributes you want to include in the HTML output and specify if you want to use fully qualified paths in the links. This is useful if you want to be able to transfer the files/folders to another computer. You can copy the folder to the other computer under the same path, i.e. C:\My Documents\Test and still be able to click on the files in the HTML listing to open them.

print directory listing

Under Sorting, you can choose to sort the files by Filename, Size, Date, and Extension.

sort files

You can also configure the program to build the directory listing recursively or not. You can choose whether you want all links in one HTML file or to create an HTML file for each separate folder.

html directory listing

Overall, it’s a useful program to quickly create HTML web pages for any folder branch in Windows.

Snap2HTML

The second program, Snap2HTML, doesn’t have as many options, but the output looks way better. Here is the HTML output for the same downloads directory on my computer:

snap2html output

The program has a very simple interface and just a couple of options. To run the program, just double-click on the Snap2HTML.exe file. Like DirHTML, this program doesn’t require an installation.

snap2html gui

First, you pick the root folder you would like to start the directory listing with. There are two options to include hidden or system files if you like. You can change the title of the HTML page and you can check Enable under Link files if you want every file to be a clickable link.

You can check the Open in browser when ready button and then click Create Snapshot to generate the HTML directory listing. You’ll be prompted to save the HTML file first and then it will open in your default web browser.

Leave a Reply

Your email address will not be published. Required fields are marked *