Use DIR Command To Generate List Of Files And Store It In File

DIR /S /B /A:-D

I use simple DIR command to generate file lists. It serves me in many scenarios. For example, I use it to generate .Net assemblies list when I conduct preliminary scan as part of code inspection process. Here are the explanations to the switches:

  • /S – search sub folders
  • /B – bare format, no summaries and headings
  • /A:-D – no directories, files only

To save generated list of files into text file simply add >C:\myfileslist.txt. The resulting command would look as follows:

DIR /S /B /A:-D *.DLL >C:\myfileslist.txt

My related posts:

Comments (2)

  1. JasonHuff says:

    Here’s a reghack to add this ListFolder option to your Explorer. Copy and save as a .reg file or add it manually.  Works on XP or Vista.  Change the Dir options as needed….enjoy.

    Windows Registry Editor Version 5.00


    @="cmd.exe /c dir /a/ogen/-p "%1">c:\dir.txt & notepad.exe c:\dir.txt &"

  2. Alik Levin says:

    Jason! This is super cool!!