Reputation: 157
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?
Upvotes: 10
Views: 63269
Reputation: 49084
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:
Upvotes: 26