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!

I am a Digital Marketing Manager for The KPI Institute.

My expertise is in SEO (Search Engine Optimization) / UX (user experience) / WordPress.

Co-founder of lumeaseoppc.ro (series of events on SEO & PPC) and cetd.ro (Book on branding for MDs).

On a personal level, I like self-development – events, sports, healthy living, volunteering, reading, watching movies, listening to music.

No comments yet.

Leave a comment

Your email address will not be published.