# Create file/folder list

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

-

## 5 Answers

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

-

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

dir /s > files.txt


doesn't accomplish?

-

Using PowerShell:

dir > filename


or, for recursive

dir -r > filename


If you want, *.foo files only:

dir . -r -filter *.foo > filename

-

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).

-
tree C: /F >> log.txt


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

-