How to export filenames into a text file

Export Windows folder filenames to a text file using Command Line

Export Windows folder filenames to a text file using Command Line

Scenario: You have a Windows folder containing a large amount of files that you need to have exported into one text file listing all the filenames.  For instance, you might need to copy & paste those filenames into an Excel spreadsheet.

Here’s a quick and easy way to do it:

1. Open a Command Window (Start > Run > cmd)

Open the command line

Open the command line

2. Navigate to the folder by using the cd command.   If you need to move up a level, use cd .. If your folder name contains spaces, surround it with quotations.

Commands to type

Commands to type

3. Type the command dir /b>filelist.txt

4.  This will create the text file inside that folder.  If you want the file output elsewhere, use a fully qualified name.  Remember that Windows uses \ as the directory delimiter, not /

The “pretty” alternative:  Simply drag and drop the folder into a Mozilla (Firefox) browser.  The directory structure will be output in a pretty HTML document.

Directory contents listed in an HTML page

Directory contents listed in an HTML page