Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

A simple text file or csv will do.

I need a program that can export the listing to a file.

share|improve this question
up vote 2 down vote accepted

Karen's Directory Printer can print the name of every file on a drive, along with the file's size, date and time of last modification, and attributes (Read-Only, Hidden, System and Archive)! And now, the list of files can be sorted by name, size, date created, date last modified, or date of last access. Of course you can save to file instead of printing.

enter image description here

Karen's Directory Printer is freeware.

Or run the DIR command from ColorConsole and then hit the button HTML or RTF

enter image description here

ColorConsole is freeware and portable.

The JR Directory Printer utility (another portable freebie) allows you to print a listing of every subdirectory and/or file contained within a directory and/or subdirectory. It supports lowercase/dos style filename, file size in KB/bytes, attributes, custom file length, etc.

enter image description here

share|improve this answer
+1. Karen's tool is quite fast, and the output is very useful. – Rob W Jun 29 '12 at 14:31

Open a command prompt in the folder you want a listing of and type "dir > output.txt".

There is an XP Powertoy that adds "Open Command Window Here" to the context menu when you right click on a folder name.

It won't be pretty, but you can control the output. Type "dir /?" for a list of options.

Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
  [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

              Specifies drive, directory, and/or files to list.

  /A          Displays files with specified attributes.
  attributes   D  Directories                R  Read-only files
               H  Hidden files               A  Files ready for archiving
               S  System files               -  Prefix meaning not
  /B          Uses bare format (no heading information or summary).
  /C          Display the thousand separator in file sizes.  This is the
              default.  Use /-C to disable display of separator.
  /D          Same as wide but files are list sorted by column.
  /L          Uses lowercase.
  /N          New long list format where filenames are on the far right.
  /O          List by files in sorted order.
  sortorder    N  By name (alphabetic)       S  By size (smallest first)
               E  By extension (alphabetic)  D  By date/time (oldest first)
               G  Group directories first    -  Prefix to reverse order
  /P          Pauses after each screenful of information.
  /Q          Display the owner of the file.
  /S          Displays files in specified directory and all subdirectories.
  /T          Controls which time field displayed or used for sorting
  timefield   C  Creation
              A  Last Access
              W  Last Written
  /W          Uses wide list format.
  /X          This displays the short names generated for non-8dot3 file
              names.  The format is that of /N with the short name inserted
              before the long name. If no short name is present, blanks are
              displayed in its place.
  /4          Displays four-digit years

Switches may be preset in the DIRCMD environment variable.  Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.
share|improve this answer

If you need a perhaps slightly 'prettier' version than if you used dir, you can do the following from the command prompt;

tree /f /a "C:\Path\Of\Directory" > C:\output.txt
share|improve this answer

Actually our friend the How To Geek has a nice little registry hack that can create you a context menu that does this for you. I use it quite regularly and it works on XP. It ends up looking like this:

Mouse Pointer

The output looks like this:


share|improve this answer

You can get a screen capture and possibly convert it to text using Snagit, or just open a Command Prompt and type:

DIR > somefilename.txt

This will produce a directory listing (the DIR command) and redirect its output to a text file called somefilename.txt. Obviously you can name that file whatever you want to.

You can then open the text file in Excel, and use Tools -> Data -> Text to Columns to get it into a spreadsheet-readable format.

share|improve this answer
Well played, +1 on command line. – MDT Guy Apr 18 '13 at 14:21

The answers already provided list what I was going to suggest initially, hopefully this answer will just solidify it:

tree /f /a

... which prints out a recursive tree of the directory listing, including files (/f), and using an ASCII output (/a).

Another option is the below, which will do a recursive (/s) listing in bare format (/b).

dir /s /b

This has the added plus that it lists the full path for the files. Obviously, if you leave out the /s switch, it will also just generate for the current directory.

You've already seen the output redirection as below, which redirects the standard output to the file:

dir /s /b>listing.txt

Also available is >> which appends the output to the file:

dir *.exe /b>listing.txt
dir *.config /b>>listing.txt
share|improve this answer

You can install Cygwin and use the Unix tools:

ls -l > file.txt

This will create a file called file.txt containing the contents of the directory.

share|improve this answer
i think i myself would prefer the native equivalent dir > list.txt – Ian Boyd Feb 18 '10 at 20:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .