List sub folder names

Page 1 of 3 123 LastLast

  1. Posts : 37
    Windows 10 X64
       #1

    List sub folder names


    Hi, I have a huge folder G:\Manga, in it are the subfolders, and I want to list only names of all subfolders within this folder G:\Manga to txt file
    how can I do this?
    Thanks!
      My Computer


  2. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #2

    Hello @Takeshi18,

    Takeshi18 said:
    I have a huge folder G:\Manga, in it are the subfolders, and I want to list only names of all subfolders within this folder G:\Manga to txt file.
    how can I do this?
    Using the cmd prompt, change to the parent directory and run this . . .
    Code:
    dir /s /a /b /o:n > "%UserProfile%\Desktop\List.txt"
    I hope this helps.
      My Computer


  3. Posts : 2,487
    Windows 10 Home, 64-bit
       #3

    Thanks for that Paul; tried to rep you but no can do until I spread more around.

    Played with that and found that this works to grab the subfolders too:

    dir /s /a /b /o:n > d:\downloads\folderlist.txt

    Is there a way to add a folder count to that command? I'm gonna try and find that. I've got tens of thousands of folders.
      My Computer


  4. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #4

    ignatzatsonic said:
    Thanks for that Paul; tried to rep you but no can do until I spread more around.

    Played with that and found that this works to grab the subfolders too:

    dir /s /a /b /o:n > d:\downloads\folderlist.txt

    That's what I put.
      My Computer


  5. Posts : 2,487
    Windows 10 Home, 64-bit
       #5

    Hmmm.......

    It seems that grabs folders and individual files as well.............if the individual files are in the root.

    I can't see a way to get a folder count or to exclude files in the root.
      My Computer


  6. Posts : 14,022
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #6

    Have you put Dir /? in a Command Prompt window to see the switches you can use?
      My Computers


  7. Posts : 2,487
    Windows 10 Home, 64-bit
       #7

    Berton said:
    Have you put Dir /? in a Command Prompt window to see the switches you can use?
    Yes. But I didn't see anything related to folder count or excluding files in the root.........that is to say "give me a list of folders ONLY, ignore files". And give me a folder count.

    Fiddling with the switches right now, without success. I still get files and without a folder count.

    I can get a folder count if I do a simple dir /s *.*
      My Computer


  8. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #8

    Hello @Takeshi18 [ @ignatzatsonic ] ,

    I have just written this script that will do what you want . . .
    Code:
    @echo off
    set "Out=%UserProfile%\Desktop\Folders_Sub-Folders.txt"
    if exist "%OUT%" (del /f /q "%OUT%" >nul 2>&1)
    set /a count=0
    for /f "tokens=*" %%A in ('dir /s /b /a:d /o:n ^| findstr /v /i "%Out%"') do (
      set /a count+=1
    >> "%Out%" echo %%A
    )
    >> "%Out%" echo ============================================================================== 
    >> "%Out%" echo Folders: %count%
    >> "%Out%" echo ==============================================================================
       echo. & echo ^>Press ANY key to EXIT . . . & pause > nul & cls & goto :Exit
    :Exit
    Copy the script into Notepad and save it as a .bat file. Put the .bat file in the directory [ Parent directory ] where you want the information. It will output a text file on the desktop named Folders_Sub-Folders.txt.

    I hope this helps.
      My Computer


  9. Posts : 14,022
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #9

    Dir /? gets a list with the number of Directories [old DOS term for Folders] and Files, my list of C:\
    List sub folder names-image.png
      My Computers


  10. Posts : 2,487
    Windows 10 Home, 64-bit
       #10

    Berton said:
    Dir /? gets a list with the number of Directories [old DOS term for Folders] and Files, my list of C:\
    List sub folder names-image.png
    Yes;

    Per my post 7.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:24.
Find Us




Windows 10 Forums