This tutorial talks about how to generate an index file from all files present in a folder. In this tutorial, I will use a free command line tool, dir-indexer, which will let you generate an “index.html” file by listing all the directories, sub directories, all types of files along with their date modified and size. You can generate the index file by excluding some paths or you can opt to create the index up to a certain level from the parent directory. It will generate a final HTML file that you can open in a browser and browse like you do in a file manager.
Using this software, you can generate an index file by including all the files like HTML, PDF, ZIP, and many others. And even you can print the directory listing to custom HTML template. And it’s very simple, all you have do is run a simple command.
There are some directory printer software which can only list the files from a certain directory in plain text form. But, the software that I have mentioned here will list the files and in the form of hyperlinks that you can click.
So now let’s see what it takes to generate an index file from all files present in a folder.
How to Generate an Index File from All Files Present in a Folder
dir-indexer is really a very nice tool that can easily generate an index file from all files present in a directory. You just have to run a simple command with some switches to get the final “index.html” file. The software only requires Python to be available on your PC.
The software lets you use your own HTML template file to generate the index file. Also, if you only want to generate the index file without subfolders and files, then you can do that too.
Here are some key steps to generate an index file from all files present in a folder.
Step 1: Download the ZIP file from GitHub and then extract it. After that, open Windows command prompt in the same folder.
Step 2: Now, run the command in the following syntax. This command will generate the index file by including all files, folders, and subfolders inside a parent folder.
python dir_indexer.py [path to the parent folder]-r
Note: If you only want to generate the index from the current level of the parent directory, then remove “-r” switch from the command.
After running the above command it will place an “index.html” file inside the parent folder whose path you have specified. You can open that HTML file in the default web browser. And it will look like the screenshot that I have shown in the beginning of this tutorial.
So, this is how you can easily generate an index file from all files present in a folder. And dir-indexer makes pretty easy to that. You can easily generate the index file for any folder and it will do that in just a few seconds.
dir-indexer is a very nice programming tool to generate an index file from all files present in a folder. It makes it pretty simple to create an index file of all files, folders, and subfodlers present in the parent folder whose path you have specified. And I really like the fact that it lets you specify your own HTML template to print the file and folder list. So, if you are looking for some tools to do the same, then this tutorial will help you.