Commands · Command

CommandWindows

dir

dir [path] [options]

Lists the files and subdirectories in a directory — the Windows CMD equivalent of Linux's ls.

// FLAGS

/ashow hidden and system files
/srecurse into subdirectories
/wwide format, multiple names per line
/o:dsort by date

// EXAMPLE

dir /a /s C:\Users\me\Documents — lists every file (including hidden ones) under Documents, recursing into subfolders.

// GOTCHA

Wildcards work but behave slightly differently than Unix globbing — dir *. (trailing dot) matches files with no extension, which surprises people coming from bash.

// RELATED COMMANDS