Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a fast way to output list of files and folders in folder in Windows XP/Vista in text file? How?

share|improve this question

5 Answers 5

up vote 8 down vote accepted

A little app called FileList should do the job nicely for you if you want something a little more powerful than dir /s > files.txt

From the README:

FileList is a command line utility that produces a list of files of the given
path in the CSV format, which can be imported in a spreadsheet or database.
The list includes the file name, the size, the path, the last access and change
date, etc. Supported Windows versions: Windows 200*/XP/Vista

Usage:

 FILELIST [/OPTION] [/FILTER pattern1;pattern2;...] [/NOHEADER]
          Path [>list.csv]

/NOHEADER   Leaves out the column headers from the output.

/ATTRIBUTES Includes a column with the attributes that are set for each file.

/OWNERS     Adds a column that contains the owner of each file. Querying the
            file owner is unfortunately a slow operation in a Windows domain,
            this is why file owners are turned off by default. USing this option
            will significantly slow down the generation of the list.

/AUTHORS    Additionally extracts name of the author from MS Office documents.
            Do not confuse the author with the owner. The owner is listed in
            an extra column by default. This switch slows down the creation of
            the list.

/LASTSAVEDATE Additionally extracts the last save date from MS Office documents.

/MD5        Includes a column with the MD5 checksum of each file.

/FILTER     Allows to specify one or more filters, separated with semicolons.
            The wildcards '*' and '?' may be used.

Using ">" the output can be redirected to a file.


INSTALLATION
~~~~~~~~~~~~
Just place FileList.exe where you want, we recommend your Windows folder.


TIPS & ANNOTATIONS
~~~~~~~~~~~~~~~~~~
* FileList uses the list separator that is set in the Control Panel of Windows.
* Using the extension .CSV for the output file enables you to open the file
  in Excel with a double click in the Explorer.
* The Windows "at" command can be used to schedule the creation of lists with
  FileList. The following command creates a list of all mp3 files including
  their owners every monday night:
  at 00:01  /EVERY:m "C:\path\to\filelist.exe" /OWNER /FILTER *.mp3 c:\ ^>output.txt
share|improve this answer

What details do you need? In particular, what do you want it to do that

dir /s > files.txt

doesn't accomplish?

share|improve this answer

Using PowerShell:

dir > filename

or, for recursive

dir -r > filename

If you want, *.foo files only:

dir . -r -filter *.foo > filename
share|improve this answer

The best I've found for you without using a batch file is:

dir /B > files.txt

This will give you all the names of the files and directories in the current folder, but to extract the size of the files out without getting the time information, looks like it will either take a batch file OR you'll need to install a Windows version of sed, and use that to edit the lines (by pipelining into it).

share|improve this answer
tree C: /F >> log.txt  

Gives a slightly more useful view really depends what you need to be able to do after.

share|improve this answer

Your Answer

 
discard

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.