There are shareware utilties out there for this, but you can do it from a DOS window also. Typing the dir command with any switches you want and then piping the output to a text file. Here is the commands available in the dir command:
DIR [drive:][path][filename] [/P] [/W] [/A[[:]attributes]]
[/O[[:]sortorder]] [/S] [/B] [/L] [/V] [/4]
[drive:][path][filename]
Specifies drive, directory, and/or files to list.
(Could be enhanced file specification or multiple filespecs.)
/P Pauses after each screenful of information.
/W Uses wide list format.
/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
/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 (earliest first)
G Group directories first - Prefix to reverse order
A By Last Access Date (earliest first)
/S Displays files in specified directory and all subdirectories.
/B Uses bare format (no heading information or summary).
/L Uses lowercase.
/V Verbose mode.
/4 Displays year with 4 digits (ignored if /V also given).
Switches may be preset in the DIRCMD environment variable. Override
preset switches by prefixing any switch with - (hyphen)--for example, /-W.
Do something like if you are at the c:\windows prompt type in dir /o:N /s /b >C:\Directory.txt this takes the contents of the windows directory, all sub directories, outputs them alphabetically in a bare format to the directory.txt file.