1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

making a txt list of folder contents on DVD

Discussion in 'Windows XP' started by slayer544, 2006/05/17.

  1. 2006/05/17
    slayer544

    slayer544 Inactive Thread Starter

    Joined:
    2006/05/17
    Messages:
    2
    Likes Received:
    0
    hello everyone. I know how to make a txt list of the contents of a folder on a drive but is it possible to do that with a DVD? I have about 30 dvd's numbered and I wanted to make a sort-of catalog of the contents. Thanks
     
  2. 2006/05/17
    Welshjim

    Welshjim Inactive

    Joined:
    2002/01/07
    Messages:
    5,643
    Likes Received:
    0
    slayer544--
    Have you tried using your normal method?
    I use Karen's Directory Printer for a text list of a directory on my harddrive
    http://www.karenware.com/powertools/ptdirprn.asp
    if I want details.

    Otherwise, for a much simpler list, I use a .bat file created in Wordpad:
    "dir %1> "C:\Documents and Settings\UserName\Desktop\jim.txt "

    cls"
    without the quotes.
    In my case, I named it jim.bat and put the jim.bat file into my Send To folder. Now when I right click on a folder, jim.bat appears on the right click (context) menu and, when clicked, creates a text document named jim.txt on my Desktop.

    As mentioned, I never tried either method using a DVD. Just from my harddrive.
     
    Last edited: 2006/05/18

  3. to hide this advert.

  4. 2006/05/17
    slayer544

    slayer544 Inactive Thread Starter

    Joined:
    2006/05/17
    Messages:
    2
    Likes Received:
    0
    that Karens Directory Printer worked like a charm! Thanks!!! :)
     
  5. 2006/05/17
    Zander

    Zander Geek Member Alumni

    Joined:
    2002/01/07
    Messages:
    4,084
    Likes Received:
    5
    FWIW, it should work for a dvd drive also. To the computer, a drive is a drive.

    If your dvd drive is x, dir x: > c:\dir.txt will create a text file with a listing of all files and folders in the root of the drive.
     
  6. 2006/05/18
    Welshjim

    Welshjim Inactive

    Joined:
    2002/01/07
    Messages:
    5,643
    Likes Received:
    0
    slayer544--Thanks for posting back with the good news. Now we all have learned!!
     
  7. 2006/05/19
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    You do need the quotes around the document path otherwise it will try to send the dir contents to "C:\Documents ". Also I don't think you need the cls. If this is a batch file the command window will close automatically at the end of the routine, so you don't need to clear the screen first. May I suggest that this is clearer:
    Code:
    dir %1 >  "%HOMEDRIVE%%HOMEPATH%\Desktop\Dir%date%.txt "
    
    And also dates the output
    Now that is neat. I like that. I called mine DirectoryList.bat. I have a bad memory and would forget what reggie.bat did.
     
  8. 2006/05/19
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    I've had a little more of a play with this. It works fine for listing folders/directories, but won't list the contents of a drive which is what the original poster wanted. However, you can get that functionality with a reg hack. Here is how to do it:

    First create a file called DirectoryList.bat and save it to your system folder (WINNT or WINDOWS depending on your setup).

    Edit the file and add the following code:
    Code:
    dir %1 >  "%HOMEDRIVE%%HOMEPATH%\Desktop\Dir%date%.txt "
    
    This version is problematic. See later post for better version.

    Then create another file called DirectoryList.reg and save it on your desktop (actually, you can put it anywhere. It will run from anywhere. However, you will need Admin rights when you run it). In this file enter this text:
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Drive\shell\Dir_list]
    @= "Create Dir text file "
    
    [HKEY_CLASSES_ROOT\Drive\shell\Dir_list\command]
    @= "DirectoryList.bat "
    
    Save the file. Then run it by double clicking on it.

    That will update your registry and enter a "Create Dir text file" option when you right click on drives. Selecting that option will generate a directory listing of the drive on your desktop.

    As with any registry hacking, make sure you back it up before changing it. The reg file creates two keys one called Dir_list with a subkey called command. Deleting the Dir_list key from the registry will remove the functionality.

    I've tested this on hard drives, CD drives, memory sticks and network mapped drives and it appears to work on them all. One peculiarity is that if it can find the drive (for example if there is no CD in the drive) then it returns the contents of your Windows directory.
     
  9. 2006/05/19
    Welshjim

    Welshjim Inactive

    Joined:
    2002/01/07
    Messages:
    5,643
    Likes Received:
    0
    ReggieB--Thanks for the additional work and suggestions. Interesting and helpful.

    And you are very correct about the need for the internal quotation marks
    I should have been specific about not using the quotes at the beginning and end or better yet, not used those quotes at all when providing the code.
     
  10. 2006/05/19
    Zander

    Zander Geek Member Alumni

    Joined:
    2002/01/07
    Messages:
    4,084
    Likes Received:
    5
    You can also add it to the context menu itself. My send to menu has gotten a bit slow lately so that's the route I took. To do this, open any folder or explorer window, click tools>folder options>file types and find folder in the list (not file folder). Click it to highlight it, click advanced and then click the new button. Where it says action type whatever it is you want it to say in the context menu (mine says print contents). Then where it says application used to perform action click the browse button and browse to and select your batch file. Then, OK your way back out. Now when you right click on any folder or drive it'll appear right in the right click context menu.

    When you do this you can use the "File Folder" file type to do it but using the "Folder" one has one small advantage. If you do it using File Folder, it'll only appear in the context menu for folders. If you use the Folder file type, it'll appear in the context menu for both folders and drives.

    I know it's not a huge difference from using the send to menu and it takes a bit more work but when you have a slightly poky send to menu, it's the way to go. I hate waiting for that send to menu to open when I don't have to. :)
     
  11. 2006/05/20
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    What a splendid thread. I love it when what seems such a simple request turns into an interesting problem solving exercise and deeper learning of "under the hood" Windows!

    Zander, that's a much better way of getting the command on to the context menu. Far better than hacking the registry directly. It also provides a way of easily removing the item too.

    I've tried your process on a Window 2000 system and it worked a treat. However that did highlight an issue with my code on 2000. %Date% on 2000 adds a day name and a space to the output. That causes the resulting path construct to cause an error. So for Windows 2000 you can't easily use a time stamp (you'll need to do something more complicated to create the date stamp):
    Code:
    dir %1 >  "%HOMEDRIVE%%HOMEPATH%\Desktop\Dir.txt "
    
    I think it is worth pointing out another aspect of the path I used. %HOMEDRIVE% and %HOMEPATH% are not my constructs, but Windows constants. If you want to see how they work open a command prompt and enter these two commands:
    Code:
    echo %HOMEDRIVE%
    
    echo %HOMEPATH%
    
    Therefore the code works no matter who or which account is logged on.
     
  12. 2006/05/20
    PeteC

    PeteC SuperGeek Staff

    Joined:
    2002/05/10
    Messages:
    28,896
    Likes Received:
    389
    I am showing my extreme ignorance here - never written a batch file and never been a 'Dosser' :)

    Creating a batch file with just the line ....

    dir %1 > "%HOMEDRIVE%%HOMEPATH%\Desktop\Dir%date%.txt "

    does not work for me on XP Pro SP2- there must be more in the file I guess.

    The reg file works a treat, but all I see is a quick flash of a command window and nothing on the Desktop - in fact no text file is created :confused:

    Edit: Reggie's second batch file for W2k works just fine on XP Pro SP2 ....

    dir %1 > "%HOMEDRIVE%%HOMEPATH%\Desktop\Dir.txt "
     
  13. 2006/05/20
    PeteC

    PeteC SuperGeek Staff

    Joined:
    2002/05/10
    Messages:
    28,896
    Likes Received:
    389
    Now - if it were possible to have the text file sorted to list directories first and then files as per Windows Explorer - that would be a bonus :D
     
  14. 2006/05/20
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    There are switches that allow you a lot of control with the DIR command. At the command prompt, type
    Code:
    DIR /?
    
    To get a full list.

    So to get what you want you could change your batch file to:
    Code:
    dir /OG %1 >  "%HOMEDRIVE%%HOMEPATH%\Desktop\Dir.txt "
    
    The OG switch orders the output so that folders are first.
     
  15. 2006/05/20
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    It is the %data% part that is problematic. On some systems (like the one I first created this batch file on) it creates a date without spaces. But if it adds spaces or uses slashes, it will mess up the path. Don't use the %date% version is probably the best policy
     
  16. 2006/05/20
    PeteC

    PeteC SuperGeek Staff

    Joined:
    2002/05/10
    Messages:
    28,896
    Likes Received:
    389
    Reggie

    That's just what I wanted - thanks.

    Yep - works for me :)
     
  17. 2006/05/20
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Glad to be of assistance :D I'm pleased WelshJim got this rolling.

    The other switch that might be interesting is /S. With that switch you also get the contents of subdirectories. To much for the screen, but might be useful as a text file.
     
  18. 2006/08/24
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Here's a useful alternative. Instead of browsing to a batch file, browse to cmd.exe (usually in system32 folder in your Windows or WINNT folder) and select that file. In the "Action:" box put "Command ". Click OK to complete the task.

    Now you have a "Command" option when you right click on a folder. Select it and a cmd shell window opens at the current folder!
     
  19. 2006/08/24
    mailman Lifetime Subscription

    mailman Geek Member

    Joined:
    2004/01/17
    Messages:
    1,901
    Likes Received:
    11
    This thread is SWEET! Thanks for bumping, ReggieB. :)

    I assume the %1 variable refers to the highlighted drive in Windows Explorer.
    • dir %1 /OG > "%HOMEDRIVE%%HOMEPATH%\Desktop\Dir.txt " works too.
      (Swapping % and /OG matches the syntax as displayed by dir /? in the CMD window if my assumption is correct.)

    Do you have a quick idea for a hack to add that will show a "Create Dir text file" context menu item for a FOLDER to produce a list of its contents (C:\WINDOWS\ for example)?
     
    Last edited: 2006/08/24

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.