Tutorial : How to generate Folder/File Listing of a Directory?

Status
Not open for further replies.

sridatta

An Esoteric Geek
Hello Guys...

How many times have you been browsing through directories in Windows Explorer and wished you could generate a text file or printout listing the files and folders? It seems like a simple request, but it's amazing the option isn't available by default. Many Third party softwares now provide this option. But why not we do it ourselves??

Here is a go....

Now, our aim is to include the option Save folder Listing into our context menu. To create the entry in the context menu it's necessary to make a command that generate folder listing.

Download the attachment and unzip it. Copy the file into c:\windows directory.

Open Windows Explorer and choose Tools --> Folder Options
Navigate to File Types --> Folder --> Advanced--> New, to open the New Action box shown

*img442.imageshack.us/img442/2207/fol1gd0.jpg

*img440.imageshack.us/img440/4999/fol2yh0.jpg

*img218.imageshack.us/img218/8517/fol3bk4.jpg

Enter the fields as shown below (or in the image above)

Code:
Action : Save Folder Listing to File
Application : C:\windows\dir2file.exe

Note: The path specified above should be same as the path where the extracted attachment file is copied. Otherwise, windows will throw an exception.

And That's it! Congratulations. You've created a new item on the context menu that's ready to go to work.

Open My Computer and browse to any path, rightclick on the folder and click "Save Folder Listing to File" , choose the path and save it to a filename. you are done..

Alternate ways :

Since, editing the folder options is sometimes risky, you can directly add the following registry keys.

Create the Key Save Folder List in the following path

HKEY_CLASSES_ROOT\Folder\shell\

Create a sub key called Command in the Save Folder List key

Edit the default value to "c:\windows\dir2file.zip" "%1" (as it is, with quotes)


For Advanced users:

We can also create a batch file script for redirecting the output of a dir command into a file. People who want to proceed further, can use this command.

Code:
dir /a /-p /o:gen >filelisting.txt

The above command, when executed in the command prompt, will save the Output of DIR Command to filelisting.txt in the current directory. You can also use this batch file to run instead of the dir2file.exe and follow the same method as above, but there are some issues with it. If you succeed doing this, please let me know.

PS: Please Post your comments if any.

For Newbies, I have created an utility which will automate the whole process in a single click. You can download it from here. You can also find the Help file in the Programfiles\Dash\FolderList directory.
*sridatta.110mb.com/software/folderlist.exe
 
Last edited:

anandk

Distinguished Member
nice. u have my rep :D try to post the source when posbl.
more here *hacks.oreilly.com/pub/h/611
keep it up !
 
OP
sridatta

sridatta

An Esoteric Geek
@techgeek thanks for the compliment
@AnandK
Thanks for the rep.
Actually i was referring to the hack given in ur link. But, the folder listing 'll only generate the list of the default folder that appears when we run cmd prompt. So, i made my own way just by referring to registry. This feature comes with a built-in tool in autopatcher. So, i uploaded the file and the corresponding registry settings.
 

djmykey

Let the music play.....
Ok first of all good tut.

But on second thoughts I wud give it a thot if I had to change any settings in the file types tab. I have had some really bad experiences before.

So a simple command line command to achieve the above task

cd to any folder whose listing you want and then

c:\> dir > c:\dir.txt
 
OP
sridatta

sridatta

An Esoteric Geek
@djmykey

Thanks for the suggestion. I'll update my tutorial even giving details of registry keys stored so that ppl 'll never screw up editing the folder options...

The additional advantages you get by following my method is...

1. In no way, you can find the sizes of all FOLDERS present in a directory. Just try out even listing them in details view. Windows 'll only display the sizes of files but not of the folders.

2. Graphical Interface. Its pretty easy to use and we can generate the folder list just with a single right click.
 

vinyas

In the zone
Use a Freeware Directory Lister:

*www.freedownloadscenter.com/Utilities/File_Cataloging_Utilities/Directory_Lister.html
 
Status
Not open for further replies.
Top Bottom