MS-DOS DIR Command Bare Directory Names
This article explains how to display bare directory names using the
DIR command in MS-DOS 6.22. It covers the specific switches
required to strip away file sizes, timestamps, and header details,
leaving only a clean list containing directory names.
In MS-DOS 6.22, the parameter that forces the DIR
command to use a bare format is /B. However, using
/B on its own lists both files and directories. To display
only bare directory names, you must combine the bare format
switch with the directory attribute switch, /A:D.
The Exact Command Syntax
To display only bare directory names in the current folder, enter:
DIR /B /AD
Parameter Breakdown
- /B (Bare Format): Strips all heading information, file sizes, timestamps, and free space summaries. It outputs only the names.
- /A:D (Attribute: Directory): Filters the output so
MS-DOS displays only items with the directory attribute set, omitting
regular files. You can type this as
/ADor/A:D.
Practical Examples
- List subdirectories in a specific path:
DIR C:\DOS /B /AD - List subdirectories in alphabetical order:
DIR /B /AD /O:N - Export bare directory names to a text file:
DIR /B /AD > DIRS.TXT