Copy Folder Names of all folders option in Context Menu

Discussion in 'Scripting' started by bundyal, Jun 26, 2022.

  1. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0
    #1 bundyal, Jun 26, 2022
    Last edited: Jun 29, 2022
    [HKEY_CLASSES_ROOT\Directory\shell\XcopyFolderTree]
    @="Xcopy Folder Tree"
    "Icon"="imageres.dll,153"

    [HKEY_CLASSES_ROOT\Directory\shell\XcopyFolderTree\command]
    @="xcopy.exe \"%1\" \"%1 - Xcopy\"\\ /t /e /h"

    I now tried this script, but it just copies the directories.
    I would like a script for my MP3 folders with music,
    So I want to select all folders in D:\MP3, right mouse click in Context Menu and then Copy Names of all folders.
    So Xcopy in context menu, which can paste all selected folders into notepad.


    IS THIS POSSIBLE ?????
     
  2. xCyBx

    xCyBx MDL Senior Member

    Aug 6, 2018
    316
    604
    10
    Try this.
    Code:
    Windows Registry Editor Version 5.00
    
    [-HKEY_CLASSES_ROOT\Directory\shell\CopyList]
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList]
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    "MUIVerb"="Copy File List"
    "SubCommands"=""
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell]
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1]
    @="Copy File Names Only"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1\command]
    @="cmd.exe /c dir \"%1\" /a:-d /b /o:n | clip"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu2]
    @="Copy Folder Names with Paths"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu2\command]
    @="cmd.exe /c dir \"%1\" /a:d /b /o:n /s | clip"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu3]
    @="Copy File Names with Paths"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu3\command]
    @="cmd.exe /c dir \"%1\" /a:-d /b /o:n /s | clip"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu4]
    @="Copy File Names and Details"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu4\command]
    @="cmd.exe /c dir \"%1\" /a:-d /o:n /s | clip"
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    Did a quick test: OK
     
  4. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    Could you make another reg file to undo all changes made? TIA
     
  5. xCyBx

    xCyBx MDL Senior Member

    Aug 6, 2018
    316
    604
    10
    This reg command remove/delete the reg above.

    Code:
    Windows Registry Editor Version 5.00
    
    [-HKEY_CLASSES_ROOT\Directory\shell\CopyList]
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0
    #6 bundyal, Jul 7, 2022
    Last edited: Jul 7, 2022
    (OP)

    Thanks for the script, but it doesn't work at all.
    You can only copy 1 foldername at a time.
    Copy File Names, I don't need it, only the folder names are important, possibly the file names.

    For example I have 10 folders with music in this place,
    D:\MP3\DB 100
    Then I want to select all directories, and have it automatically create DB 100.txt, with all directory names in it that I selected.
    Or that I select all folders, and then I can paste all folder names into a notepad file.
     
  7. xCyBx

    xCyBx MDL Senior Member

    Aug 6, 2018
    316
    604
    10
    I searched many times for get the best solution for you. But no answers.
    I hope to this useful for you.
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList]
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    "MUIVerb"="Copy File List"
    "SubCommands"=""
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell]
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1]
    @="Copy Folder Names with Paths"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1\command]
    @="cmd.exe /c dir \"%1\" /a:d /b /o:n /s>FolderNames_List_%%Random%%.txt"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu2]
    @="Copy File Names with Paths"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu2\command]
    @="cmd.exe /c dir \"%1\" /a:-d /b /o:n /s>FileNames_List_%%Random%%.txt"
    
    This produce text file besides folder you clicked.

    For remove this reg use:
    Code:
    Windows Registry Editor Version 5.00
    
    [-HKEY_CLASSES_ROOT\Directory\shell\CopyList]
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. kaljukass

    kaljukass MDL Guru

    Nov 26, 2012
    3,396
    1,322
    120
    Did I understand correctly, you want get only folders names from this/selected main directory, but you do not want to get any of subfolder names?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0

    It still doesn't work.
    Try it yourself.
    He copies 1 folder with all subfolders.
    I want all folders without subfolders.

    I do have a script that works
    but do you know a way that he makes the name of the folder where all the folders are, so from DB 100.txt
    and if I create a folder DB 101, so it must create DB 101.txt
     
  10. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0
    Yes that's right

    I do have a script that works
    but do you know a way that it also makes the name of the folder where all the folders are, so from DB 100.txt
    and if I create a folder DB 101 that contains all the folders, so it must create DB 101.txt
     
  11. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0
    #11 bundyal, Jul 7, 2022
    Last edited: Jul 7, 2022
    (OP)

    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\copylist]
    @="Copy Folder List"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\copylist\command]
    @="cmd /c dir /A:D /B > FolderList.txt"
    This script works.
    But now it creates FolderList.txt as folder name.

    How can I make it automatically create the folder name that contains all the folders.
    I have all folders in DB 100
    the next folder will be DB 101
     
  12. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0
    #12 bundyal, Jul 7, 2022
    Last edited: Jul 7, 2022
    (OP)
    This script works.
    But now it creates FolderList.txt as folder name.

    How can I make it automatically create the folder name that contains all the folders.
    I have all folders in DB 100
    the next folder will be DB 101
     
  13. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    @bundyal
    Put your code within Plain and /Plain tags so your comment won't show an emoji


    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\Directory\Background\shell\copylist]
    @="Copy Folder List"

    [HKEY_CLASSES_ROOT\Directory\Background\shell\copylist\command]
    @="cmd /c dir /A:D /B > FolderList.txt"
     
  14. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0

    Put your code within Plain and /Plain tags
    How do I do that ?
     
  15. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,359
    7,078
    210
    [ plain]text[/plain ]

    (Delete the blanks in the tags).

    Recommended: Put the Regedit code in [ code][/code ] tags where it belongs.

    (Again, delete the blanks in the tags).
     
  16. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0

    I changed it all.
     
  17. bundyal

    bundyal MDL Junior Member

    Jun 28, 2014
    85
    76
    0
    kaljukass or xCyBx

    can you help me with the script?
    The script from me above works fine, but how do you save the script with the name of the subfolder automatically ?
     
  18. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    @xCyBx

    Is there any chance to make it recursive?
    It only works with one folder and ONLY files within

    Code:
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1]
    @="Copy File Names Only"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1\command]
    @="cmd.exe /c dir \"%1\" /a:-d /b /o:n | clip"
    
     
  19. xCyBx

    xCyBx MDL Senior Member

    Aug 6, 2018
    316
    604
    10
    Folders only recursive
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1]
    @="Copy Folder Names Only"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1\command]
    @="cmd.exe /c dir \"%1\" /a:d /b /o:n /s | clip"

    Files only recursive
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1]
    @="Copy File Names Only"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1\command]
    @="cmd.exe /c dir \"%1\" /a:-d /b /o:n /s | clip"

    Both Files & Folders recursive
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1]
    @="Copy Files and Folders Names"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1\command]
    @="cmd.exe /c dir \"%1\" /b /o:n /s | clip"
    
    Try and give me feedback
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    @xCyBx

    Thanks you but I am talking about the first option

    again

    Code:
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1]
    @="Copy File Names Only"
    "Icon"="%SystemRoot%\\System32\\imageres.dll,157"
    
    [HKEY_CLASSES_ROOT\Directory\shell\CopyList\Shell\menu1\command]
    @="cmd.exe /c dir \"%1\" /a:-d /b /o:n | clip"
    
    It actually works with only one folder. It creates a list with all files contained within.
    It stops working ie it does nothing if the folder contains subfolders within.

    What I want is to copy a list of all files within the main folder and subfolders whiteout paths or folder names.