Correction to the list files and folders from a directory to a file

I think you all remember OKTHEN, the one who told us all an easy way to list files and folders in a directory into a file through a context menu. He posted it as a comment. Well last day he commented on the post to correct some mistakes in the comment. Here is his new comment :

sorry i messed up a while back
cmd /c dir %1 /a /b >%1\list.txt

would not only be unable to list files in folders with long file names but also it would not be able to output the list.txt to a folder with a long file name in order for it to work with long folder names, u need to use quotes around the %1’s also, if you use >> instead of > It will append to any existing list.txt in the folder you are catalogging instead of replacing the text file with a new one

if you want to append to a pre-existing list.txt when one already exists in the output folder then use:

cmd /c dir “%1? /a /b /s >>”%1?\list.txt

or if you want it to replace a possibly pre-existing list.txt in the same output folder every time

cmd /c dir %1 /a /b >%1\list.txt

————————————————
if you don’t wanna screw around in regedit
————————————————
then copy the following to a notepad document and then save it (where you can find it to click on) as listfiles.reg (NOTE make sure when u are in the save as dialog box in notepad you must use quotes around “listfiles.reg” otherwise it will loose its .reg extension and be useless)

[Start copy below this line]

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Make FileList]

[HKEY_CLASSES_ROOT\Folder\shell\Make FileList\command]
@=”cmd /c dir \”%1\” /a /b /s >>\”%1\”\\list.txt”

[End copy above this line]

once the above is saved into a file called “listfiles.reg”
find the file in whatever folder you put it in
Right click on the file, left click on Merge
a box will ask are you sure? Yes/No click Yes

now you have a new command available “Make FileList”
when you right click any folder you will see this option

if you left click on the option it will then create a new file within that folder called list.txt which contains the contents of that folder as it was each time you told it to make a list

i realized awhile back i did not afford for long folder names but only now decided to correct it since i want to use almost the exact same thing to create a context deltree command (for quick erasure of files when i want it without using 1: shift+delete or 2: telling recycle bin to never be active keep files)

I am sorry that after his comment I didn’t check the method he mentioned. Actually his methos is easier. He has made it a lot more easier this time by telling a method to do it by using a reg file.

Hi OKTHEN,
thank you very much. BTW since I don’t know your email or website I can’t contact you. So please send me your contact details if you don’t mind. If you are interested in doing a guest post please contact me..

Buy me a cup of hot coffee - help me keep posting all through the night

If you are new here you may want to subscribe to this blogs full feed RSSSubscribe to full feed RSS of this blog
so that you will get the updates automatically to your feed reader.

Tags: , , , ,

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

RSS feed | Trackback URI

Comments »

No comments yet.

Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post



My Google  Netvibes  My Yahoo!  Windows Live  Bloglines  Newsgator