Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a few hundred files in a folder on a Windows 7 machine. Is there a way to generate an XLS, or CSV file from the file names in the folder?

A text file is fine as well; Just looking for any method to automatically extract the file names.

share|improve this question
up vote 6 down vote accepted

One very quick and dirty way is the command prompt. Simply open one, navigate to your folder and funnel the result into a text file using this command:

dir > filenames.txt

You will have to do some cleaning up, but as I said "quick and dirty". :-) If you only want certain objects you can of course limit the output of your 'dir' command.

The option Cybertox mentioned might be a good idea:

/B Uses bare format (no heading information or summary).

share|improve this answer
dir /b would get you just the filenames – Cybertox Apr 22 '14 at 16:21
Quick and easy exactly what I needed thanks – Anagio Apr 22 '14 at 23:04
dir /b - all files ... except hidden files. If you want those, include /a. For more options try dir /? – Adrian Pronk Apr 24 '14 at 11:15

You can use PowerShell to create an actual CSV file:

dir | Export-Csv MyFileList.csv

share|improve this answer

This used to work on older Windows versions and gave the full path of all files:

dir /s /b > list.txt
share|improve this answer
Assuming you don't want the directory names of the directories each directory contains, use: dir /s /b /a-d > list.txt – SiteNook Apr 23 '14 at 1:09

If you also want the metadata (owner, size, modified date), see PowerShell command to write directory to CSV for a one-liner

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.