How to Export Lists of Folders and Their Contents from Windows Explorer to a Text File

This works for Windows XP - it can probably be modified for other versions of Windows

Windows Explorer (which used to be called File Manager) does not provide an easy way of extracting a list of the files in a folder (directory) for pasting into another application. The technique described here is based on Microsoft Support Document Q321379 for printing the directories, but instead of printing it exports the material to a text file in the root directory of the C: drive - C:\FileList.txt.

Once the modification has been made all that is necessary to export details of a directory and its contents (including any sub-directories and their contents) is to click on File: Save Directory (and Sub-Directory) Listing in the Windows Explorer toolbar.

The action overwrites any previous version of FileList.txt, so to perform multiple exports it is necessary to rename FileList.txt (or copy it to another directory) after each export.

There are three steps to the modification of Windows Explorer:

STEP 1

Open Notepad and paste in the following text:

@echo off
dir %1 /s /-p /o:gn > C:\FileList.txt
exit



Save As %windir%\SaveFileList.bat

STEP 2

Open Control Panel - Folder Options.
Click File Types tag.
Select File Folder, click Advanced then New
In the Action Box type Save Directory (and Sub-Directory) Listing.
In the Application used to perform action box type SaveFileList.bat.
Click OK as many times as necessary and then close.

STEP 3

Edit the Registry.
The usual warnings apply - mistakes here can foul up Windows badly.
Proceed at your own risk and back up the Registry before you start in case of accidents.

However this is a very minor Registry edit and is most unlikely to cause trouble.

Run regedit
Locate the Default value under the registry subkey
HKEY_CLASSES_ROOT\Directory\shell [Substeps (1) & (2)].
Select Default [(3)].
Click Edit and Modify [(4)].
Enter none in Value data: [(5)].
Click OK and exit Regedit [(6)].

The screen never shows this exact display.
This is a composite of the displays of substeps (1) to (6).

Now open Windows Explorer and select a folder - you should find Save Directory (and Sub-Directory) Listing in the File dropdown of its toolbar. Click on this and the listing of the files in the directory and all its sub-directories will be saved as C:\FileList.txt. Remember that this overwrites any previous data in this file.

Number of visits to this page