How to List Files Recursively in MS-DOS 6.22

In MS-DOS 6.22, navigating complex directory trees often requires viewing files across multiple subfolders simultaneously. This article explains the specific command parameter used with the DIR command to display file structures recursively, details how it operates, and provides practical syntax examples to help you locate and organize files across your system.

The Recursive Parameter: /S

The parameter that enables recursive directory listing in MS-DOS 6.22 is /S.

When appended to the DIR command, the /S switch instructs MS-DOS to list every occurrence of the specified file or directory not only in the current folder, but also within all subdirectories nested beneath it.

Basic Syntax

To view all files and subdirectories within your current location and all child directories, enter:

DIR /S

To run a recursive search starting from the root of a specific drive:

DIR C:\ /S

Finding Specific Files Recursively

The /S switch is most frequently used to locate files when their exact folder location is unknown. You can combine the parameter with specific filenames or wildcards:

  • Find a specific file:
    DIR AUTOEXEC.BAT /S
  • Find all text files on the drive:
    DIR C:\*.TXT /S

Combining /S with Other Useful Switches

Because recursive listings often generate hundreds of lines of output, combining /S with other standard MS-DOS parameters improves readability:

  • Pause per screen (/P): Prevents text from scrolling off the monitor by pausing after each screenful of data.
    DIR /S /P
  • Bare format (/B): Strips header information, file sizes, and summary statistics, displaying only the full drive, directory path, and filename for each match.
    DIR C:\*.EXE /S /B
  • Wide display (/W): Arranges the file listings horizontally across the screen to fit more items in fewer rows.
    DIR /S /W