# is it possiblr to get a text list of directories in win2k?

**URL:** <https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742>\
**Category:** Factual Questions\
**Created:** [January 27, 2007, 6:39pm UTC](https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742 "2007-01-27T18:39:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pope\_hentai](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pope\_hentai](https://boards.straightdope.com/u/pope_hentai)\
**Post date:** [January 27, 2007, 6:39pm UTC](https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742/1 "2007-01-27T18:39:34Z")

</div>

I’m in a situation where right now a text list of all the subdirectories in a single directory need to be written as a text file. is there any way i can have windows do this for me or am i going to have to manually type the names of 150+ directores to text?

---

<div class="post-metadata">

**Author:** ![phaemon](https://avatars.discourse-cdn.com/v4/letter/p/977dab/32.png) [@phaemon](https://boards.straightdope.com/u/phaemon)\
**Post date:** [January 27, 2007, 6:43pm UTC](https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742/2 "2007-01-27T18:43:25Z")

</div>

From a command prompt:

cd c:\somefolder  
dir /ad /b \> dirlist.txt

will give a list of just the subfolder names from the folder somefolder into the file dirlist.txt

---

<div class="post-metadata">

**Author:** ![pope\_hentai](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@pope\_hentai](https://boards.straightdope.com/u/pope_hentai)\
**Post date:** [January 27, 2007, 7:20pm UTC](https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742/3 "2007-01-27T19:20:07Z")

</div>

having a bit of trouble with the command line, i cant get it to change drives as the directories are on the f drive… the command should be cd f:\ correct? when i type this and f prompt pops up but the changes to a c prompt…

---

<div class="post-metadata">

**Author:** ![Hunter\_Hawk](https://avatars.discourse-cdn.com/v4/letter/h/50afbb/32.png) [@Hunter\_Hawk](https://boards.straightdope.com/u/Hunter_Hawk)\
**Post date:** [January 27, 2007, 7:24pm UTC](https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742/4 "2007-01-27T19:24:58Z")

</div>

No, to get to the other drive you just type the drive letter, so it would be:

C:&gt;f:

…and then do F:&gt;cd dirname to get to the next directory down and so forth. Or you could just type in the full path if that’s easier.

---

<div class="post-metadata">

**Author:** ![gazpacho](https://avatars.discourse-cdn.com/v4/letter/g/6f9a4e/32.png) [@gazpacho](https://boards.straightdope.com/u/gazpacho)\
**Post date:** [January 27, 2007, 7:26pm UTC](https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742/5 "2007-01-27T19:26:27Z")

</div>

[QUOTE=pope\_hentai]  
having a bit of trouble with the command line, i cant get it to change drives as the directories are on the f drive… the command should be cd f:\ correct? when i type this and f prompt pops up but the changes to a c prompt…  
[/QUOTE]

In the command line type  
f:  
your prompt should now be something like F:&gt;

---

<div class="post-metadata">

**Author:** ![Number](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/number/32/242_2.png) [@Number](https://boards.straightdope.com/u/Number)\
**Post date:** [January 27, 2007, 9:15pm UTC](https://boards.straightdope.com/t/is-it-possiblr-to-get-a-text-list-of-directories-in-win2k/389742/6 "2007-01-27T21:15:56Z")

</div>

You can also use \*_cd /d f:\*_ or \*_pushd f:\*_ to change directories and drives at the same time.

Or just put all the paths in one command like this:  
**dir f:\ /ad /b \> c:\dirlist.txt**.
