New to using cmd, just wanted to know is there a way to list all folders their subfolders, if any, but not the files.
e.g.D:\Movies\ dir /s /b
gives me list of all files and folders located in Movies
, and also its subfolders e.g. D:\Movies\Watched
.
I would like to display only folders its subfolders, not their files. Is it possible?
Substitute dir /A:D. /B /S > FolderList. txt to produce a list of all folders and all subfolders of the directory. WARNING: This can take a while if you have a large directory.
dir /ad /b /s will give the required answer.
You can use the DIR command by itself (just type “dir” at the Command Prompt) to list the files and folders in the current directory.
Open up a File Explorer window in the folder containing the other folders. In the search box (top right), type NOT kind:folder . You will now see a list of all files in your current folder and all its subfolders. Use Control-A to select all the files.
Yes, this is possible as it can be read on running in a command prompt window dir /?
which outputs the help for command DIR.
dir D:\Movies\* /AD /B /ON /S
This command outputs
/AD
(attribute directory) including those with hidden attribute set,/B
(bare format),/ON
(order by name)D:\Movies
and all subdirectories because of /S
and/S
.A small modification of the command line is needed to ignore directories with hidden attribute set:
dir D:\Movies\* /AD-H /B /ON /S
-H
after /AD
results in ignoring hidden directories.
See also:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With