# Exporting file names as a list

**URL:** <https://boards.straightdope.com/t/exporting-file-names-as-a-list/504702>\
**Category:** Factual Questions\
**Created:** [July 29, 2009, 8:39pm UTC](https://boards.straightdope.com/t/exporting-file-names-as-a-list/504702 "2009-07-29T20:39:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hampshire](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hampshire/32/4887_2.png) [@Hampshire](https://boards.straightdope.com/u/Hampshire)\
**Post date:** [July 29, 2009, 8:39pm UTC](https://boards.straightdope.com/t/exporting-file-names-as-a-list/504702/1 "2009-07-29T20:39:07Z")

</div>

How can I export a list of file names or folder names off of a drive onto an excel spreadsheet?

---

<div class="post-metadata">

**Author:** ![Dervorin](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@Dervorin](https://boards.straightdope.com/u/Dervorin)\
**Post date:** [July 29, 2009, 8:47pm UTC](https://boards.straightdope.com/t/exporting-file-names-as-a-list/504702/2 "2009-07-29T20:47:42Z")

</div>

Open up a command prompt (Start-\>Run-\>Cmd) and then navigate to the directory you want to list. Type the command

> [@](#):
>
> dir /b\>c:\file.txt

where c:\file.txt is the file you want to write to. Open up the file in Notepad and copy the contents into Excel.

> [@](#):
>
> dir /on /b\>file.txt

will sort the names alphabetically, although you could easily do that in Excel.

---

<div class="post-metadata">

**Author:** ![Hampshire](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hampshire/32/4887_2.png) [@Hampshire](https://boards.straightdope.com/u/Hampshire)\
**Post date:** [July 29, 2009, 8:53pm UTC](https://boards.straightdope.com/t/exporting-file-names-as-a-list/504702/3 "2009-07-29T20:53:47Z")

</div>

Thanks much!
