How to print directory contents using command line

There are tons of applications for windows that allows you to print the contents of a directory to a text file.

There’s karen’s directory printer. Its easy to use, but  it requires installation. Isn’t it better if you’ll be able to print the contents of a directory without having to install anything?

Enter, the command-line. Here’s how you can do it in windows:


You will come up with a file like this:

08/19/2010  08:56 AM        78,925,456 Naruto100.avi
08/19/2010  09:37 AM        71,677,282 Naruto101.avi
08/19/2010  09:43 AM        78,955,496 Naruto102.avi
08/19/2010  09:49 AM        71,761,418 Naruto103.avi
08/19/2010  09:55 AM        78,765,556 Naruto104.avi
08/19/2010  10:01 AM        71,830,582 Naruto105.avi
08/19/2010  10:06 AM        78,968,464 Naruto106.avi
08/19/2010  10:13 AM        78,839,558 Naruto107.avi
08/19/2010  10:20 AM        78,829,924 Naruto108.avi
08/19/2010  10:26 AM        71,820,024 Naruto109.avi
08/19/2010  10:32 AM        71,726,376 Naruto110.avi

As simple as that. If you are using windows vista or windows 7. Its even more easier. Just press ‘shift’ on your keyboard then right click the directory/folder that you want to print out its contents. Then select ‘open command window here’.

A command line window will open up, with the corresponding location. And if you want that only the filenames will be printed. Just type:

dir b og>filename.txt

b and og are parameters for the dir command that omits the date when the file was created and its size. Thus producing an output like this:


One thought on “How to print directory contents using command line

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s