Create A List Of Names Of Files In A Windows Folder

THL Toolbox > Developers' Zone > Generating Filename List for Windows

Generating Filename List for Windows

Contributor(s): Mark Ferrara

Here is a Freeware utility I've used for a couple years that offers some useful features to accomplish this and more.

Oscar's File Renamer external link:

With a Mac it's easy to copy a list of files in a folder to a text document, but difficult on Windows. Here is a way to do it. In the command prompt type the name of the folder you want a list of and then the file you want to write the list to. So in this case I get the contents of "temp" and write it to a file called "filelist.txt".

Here's how:

dir C:temp > C:filelist.txt

It's that simple. here is what i got:

  • Directory of C:temp

04/13/2004 01:52 PM <DIR> . 04/13/2004 01:52 PM <DIR> ..

03/12/2004 12:39 AM 1,343,488 01929_comics-2 .04.mp3

08/19/1998 11:25 AM 47,124 ALABAS.TTF

08/18/2003 01:29 PM <DIR> rasterproxies

03/10/2004 02:54 PM 126

03/10/2004 02:52 PM 126

03/31/2004 07:15 PM 144

10/23/2003 04:28 PM <DIR> tm

10/23/2003 04:24 PM 196,781

6 File(s) 1,587,789 bytes

4 Dir(s) 12,923,981,824 bytes free

If you want a simple list of the names of the files in the folder without the date, time, size, or the directories listed, you can type:

dir /a-h /b > C:filelist.txt

Another command for creating a file list is:

dir /a /-p /o:gen >filelisting.txt

This comes from an O'Reilly hack page that also explains how to make file listing part of the right-click, context menu for folders so that by right clicking on a folder you can automatically generate a filelist for that folder. The page is at:

external link:

However, I found that their technique does not quite work the way they describe. For one, as many users complained, their batch script fails to open the filelist after creating it. Secondly, it gives the dates, times, etc for all files and directories, instead of just listing their names. Thirdly, I also found that it did not give the file list for the folder that was right-clicked on but for its parent. So, I modified the batch script as follows.

echo off

cd %1

dir /a-h /b /-p /o:gen >filelisting.txt


cd ..

echo on

Their basic instructions for creating it as a right-click context link is as follows:

  • Create the above file in Notetab
  • Save in the C:/WINDOWS folder as a ANSI file type with the name filelist.bat
  • In Windows Explorer choose Tools menus, Folder Options
  • Choose the File Types Tab
  • Choose the Folder type
  • Click the Advanced Button
  • Click the New Button
  • Under the Action box put in "Create File Listing"
  • Use the Browse button to located the "filelist.bat" file
  • Click OK to close all windows

Warning! : This adds an entry in the Windows registry. To remove the right-click, file list option is a more complicated process requiring the use of Window's RegEdit program. Instructions for that can be found at the same O'Reilly page listed above.

Another possible solution is the following. Note that no THL staff has used this. external link:

Provided for unrestricted use by the external link: Tibetan and Himalayan Library