List files and folders in the current directory.
dirList files and subdirectories, with filters, sorting and output-format switches.
dir [<drive>:][<path>][<filename>] [...] [/p] [/q] [/w] [/d] [/a[[:]<attributes>]][/o[[:]<sortorder>]] [/t[[:]<timefield>]] [/s] [/b] [/l] [/n] [/x] [/c] [/4] [/r]The linked Microsoft Learn article is the upstream authority. Availability may depend on Windows release, role, optional feature or interactive tool context.
List files and folders in the current directory.
dirShow all items, sort by date in reverse order and pause between screens.
dir /a /o:-d /pList matching log-file paths under C: and its subdirectories.
dir /s /b C:\*.logList matching files recursively without listing directories.
dir /s /b /a:-d *.txt| Option / clause | Description |
|---|---|
[<drive>:][<path>][<filename>] | Select a drive, directory or matching file names. |
/p | Pause after each screen of output. |
/q | Show file ownership information. |
/w /d | Use wide output; /d sorts the wide listing by columns. |
/a[:<attributes>] | Filter by directory, hidden, system, reparse-point, read-only, archive or non-indexed attributes; prefix - to exclude an attribute. |
/o[:<sortorder>] | Sort by name, extension, directory-first, size or date/time; prefix - to reverse a key. |
/t[:c|a|w] | Select creation, last-access or last-write time. |
/s | List matching items in the current directory and all subdirectories. |
/b | Use a bare listing without summary information. |
/l /n | Use lowercase names or long-list format. |
/x | Show short names generated for non-8.3 file names. |
/c /-c | Show or suppress thousands separators in file sizes. |
/4 | Display years with four digits. |
/r | Display alternate data streams. |
/? | Display command help at the prompt. |
<timefield> | Microsoft documents this argument or subcommand; check the linked reference for its required format and context. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.