Generating Files and Folders List
|5 July 2008||Posted by whiztech under Uncategorized|
A few days ago, one of my friend asked me on how to create a list of files and folders of a directory so that he can print the list. You can do this easily by using the built-in command in Windows Command Prompt or by using some software.
Using command prompt
1. To make your work easy, open notepad or your favourite text editor.
2. In the text editor, type dir /s > output.txt.
3. Save it to a folder where you can find it easily. Make sure you save it as a .bat file. I will save it as C:\genfile.bat.
4. To generate files list of a folder, copy genfile.bat into the folder where you want to generate the files list. Then double click genfile.bat.
Context menu hack by The Elder Geek.
1. This will enable you to easily generate file list using the above .bat file from a right click menu.
2. Open Control Panel > Folder Options. Open Files Types tab.
3. Find Folder (1), then click Advanced (2).
4. In the Edit File Type dialog, click New to open the add New Action dialog.
The text that you enter in Action will be the name of the right click menu. Application used to perform action is the location of the .bat file that you created earlier.
5. The context menu is quite buggy and not very perfect actually. If you would like to generate files in D:\M\Metallica folder for example, you should open the Metallica folder, and right click any folder in the Metallica folder and then click the Generate File List menu (create an empty folder if there are no folder inside Metallica folder), not by right clicking the Metallica folder from D:\M.
You can customize any of these options:
- dir is a MS-DOS command to print to screen a list of files and directories in current folder.
- /s is the option to list the files in the current directory and the subdirectories.
- You can customize the output of the dir command by adding any extra options.
You can access the the options of dir command by typing dir /? in the command prompt. For example, if you want the output to be displayed in a wide format, and to include all the files in the subdirectory, use the command dir /s /w > output.txt.
- The > symbol is to make the system to save the output from dir command to a text file, which in this case, output.txt. You should not left this symbol.
- output.txt is the file name where the output will be saved.
If you want to remove the context menu that you created earlier (if you don’t like it somehow), open the registry editor (Start Menu > Run > type regedit), navigates to HKEY_CLASSES_ROOT\Folder\shell. Expand the shell entry, delete the subkey that represent the context menu entry that you add earlier (in my case, Generate File List). *WARNING* This steps involves registry editing. Make sure you know what you are doing.
Output generated using command prompt method
Using specialized software
The method above is somehow quite tricky. If you are looking for hassle-free method, there are 2 freeware that allows you to generate files and folders list easily.
This simple software will generate files and folders list for you easily. The interface is very simple. Just choose the folder that you want to generate the files and folders list from, and choose what type of additional information that you want to include in the list, and press start. JR Directory Printer is freeware.
Output generated by JR Directory Printer
This software will provides you the ability to fully customize the output of the list of files and folders that you want to generate. You can set the program to include variety types of information to the output. This program allows you to directly print the files list. However, I think you might want to edit the output first before you print it. Karen’s Directory Printer is free and open source, written using Visual Basic 6.
Output generated by Karen’s Directory Printer