How to list all files and folders in the current directory using the dir command

The dir command is used to display a list of all files and folders within a directory on a Windows operating system.

When run without any arguments, it will display all of the files and folders in the current directory, along with information such as the file size, date modified, and file attributes – pretty useful!

Open Command Prompt as Administrator

1) Press the Windows Key
2) Type cmd and press return
3) Right Click the Command Prompt icon and select ‘ Run as Administrator’

Type the command

To list all files and folders in the current directory using the dir command, simply type the command:


You should then see something like this;

One of the most common modifiers for this command is the /a flag.

The /a flag will show all files and folders, including the hidden files and folders, which can be really useful.

Simply type;

dir /a

dir command modifiers

The dir command has quite a lot of options that you can append to it.

The most common is probably displaying a list of all files in a specifically specified folder, to do this you would type;

dir /a "C:\example\directory"

But there are plenty of other options, you can see them all by typing;

dir /?

 /A          Displays files with specified attributes.


  • D  Directories
  • R  Read-only files
  • H  Hidden files
  • A  Files ready for archiving
  • S  System files
  • I  Not content indexed files
  • L  Reparse Points
  • O Offline files

  /B         Uses bare format (no heading information or summary).

  /C         Display the thousand separator in file sizes.

  /D         Same as wide but files are list sorted by column.

  /L          Uses lowercase.

  /N         New long list format where filenames are on the far right.

  /O        List by files in sorted order.


  • N  By name (alphabetic)
  • S  By size (smallest first)
  • E  By extension (alphabetic)
  • D  By date/time (oldest first)
  • G  Group directories first    –  Prefix to reverse order

  /P         Pauses after each screenful of information.

  /Q        Display the owner of the file.

  /R         Display alternate data streams of the file.

  /S         Displays files in specified directory and all subdirectories.

  /T         Controls which time field displayed or used for sorting


  • C  Creation
  • A  Last Access
  • W  Last Written

  /W       Uses wide list format.

  /X         This displays the short names generated for non-8dot3 file

              names.  The format is that of /N with the short name inserted

              before the long name. If no short name is present, blanks are

              displayed in its place.

  /4         Displays four-digit years

Leave a Comment