I am trying to print a list of the folders and sub folders of a directory to a file.
When I run dir /s/b/o:n > f.txt
, I get a list of the files also. I only need the folders and sub folders.
Anyone know is this possible to do this from command line interface?
I used
dir /s /b /o:n /a:d
, and it worked perfectly, just make sure you let the file finish writing, or you'll have an incomplete list.just set type of desired file attribute, in your case /A:D (directory)
dir /s/b/o:n/A:D > f.txt
dir /ad /b /s will give the requried answer
Try this: