07 April 2008 Categorized under Uncategorized

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 ..


Some related articles you may like :

  1. Add a context menu option to list all files in a folder and save it as text file
    okthen has commented here with an easier way if you know registry : Go to the Folder tree My Computer\HKEY_CLASSES_ROOT\Folder\shell\ Right Click and select New»Key...
  2. Batch files to automate tasks in Windows environment – tutorial
    A Batch file is any file with an extension .bat . The batch file is special in the sense that whatever you enter in a...
  3. Prevent copying of files to USB drive
    There are times when you want to prevent others from copying your data but you still need them to be able to view it on...
  4. Why are permanently deleted file recoverable form a memory device?
    If you have accidentally deleted some files don’t panic follow these steps. 1. Do not read, write or access that Drive. 2. Use this to...
  5. How to open unknown files – without extension
    There are times when we are not quiet sure which program could be used to open a file. Worst case scenario is when the file...
  6. Prevent system slowdown due to large Host file
    A large host file can slow down your system significantly as said in the . This is mainly notable in W2000/XP. Windows 98 and ME...

Leave a Reply