Daily Archives

1 September 2016

Using Command Prompt’s “dir” command to display the contents of a folder

Let’s say you have a folder with files, and you want to save the full list of files in a text file.

The solution is to open Command Prompt (Win + R, cmd, enter), and type this:

dir /s /O:GNE >output.txt

This will result in the full contents of “Olivian Breda” folder being listed in the file “output.txt”, which is created if it doesn’t exist, and overwritten in case it already exists.

Do you want just the current folder, not the subfolders? Just remove “/s”.

dir /O:GNE >output.txt

Do you want the listing to be displayed on the screen, as opposed to in a file? Remove “>output.txt”.

dir /s /O:GNE

Cheers!