Let’s learn about the MS-DOS directory command in this tutorial. The directory command is dir.
MS-DOS Directory Command
The MS-DOS directory command is used to display the list of files and subfolders (subdirectories) in the current directory or the specified directory.
The directory command displays the contents of the directory. It lists the files, sub-directories, and other information in a directory or folder. The directory command is like a table of contents in a book.
The basic syntax for the directory command is as follows:
\> dir [drive:][path][filename] [/A[:attributes]] options
Square brackets [ ] indicate optional parameters and : (colon) indicates that an additional value can be provided in the command.
This example will list files and subdirectories in the current directory. The steps to follow are:
- Open the command prompt and issue the following command.
- At the command prompt type, dir and press ENTER key.
This directory will list the following information:
- Date and time the file was last updated.
- <DIR> to indicate whether the entry is a directory.
- Size of each file
- File name or directory name with the file extension
The list of files will scroll up and off the screen. At the end of the listing, the summary of the files and directories is displayed. A line that shows the number of bytes free on the hard drive.
More information on the MS-DOS commands: