Question:
batch job. create a list of all directories in a system?
Netiad
2007-04-23 20:12:03 UTC
How to create a list of all directories in a system. This is really close

for /r %%x in (*) do echo %%x >> textfile.txt

However it creates a list of all files and their directory paths in a system. I want a list of all directories. I want each directory to be recorded only once.

thanks.
Six answers:
Kevin
2007-04-27 06:22:05 UTC
Here's one way to do that,



dir \ /s /b /ad > textfile.txt



"\" = start from the root directory

"/s" = get all subdirectories

"/b" = bare information, just names

"/ad" = just get directories
?
2016-07-23 11:55:37 UTC
2
Jeffrey F
2007-04-23 20:21:54 UTC
try from the c:\ prompt



dir *. >dirlist.txt



Folders do not have an extension to their name, therefore *. will show wildcard DOT entries in the drive



the file is parsable in a program if need be, as I've done it once before. you may also use any of the DIR command switches. the > directs the output to the file named.
Amanda H
2007-04-23 20:23:11 UTC
Do



for /r /d



and then the rest.



You do know you can type for /? for a list of switches, right?



Any DOS command with a /? will usually give you a list of options.
?
2016-07-10 07:18:44 UTC
Paid Surveys At Home : http://OnlineSurveys.uzaev.com/?yvlB
Bohdan
2007-04-23 20:21:04 UTC
How about this simple DOS command:



c:\dir /a:d /s /b >>textfile.txt


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...