Create file/folder list

All we need is an easy explanation of the problem, so here it is.

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

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

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


 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.

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

* 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

Method 2

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

dir /s > files.txt

doesn’t accomplish?

Method 3

Using PowerShell:

dir > filename

or, for recursive

dir -r > filename

If you want, *.foo files only:

dir . -r -filter *.foo > filename

Method 4

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

Method 5

tree C: /F >> log.txt  

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

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply