dirq.net

the life and work of dirk watkins

Command Line Display of a Folder Tree

| 1 Comment

If you have ever needed to print out a folder hierarchy in Windows this is for you. Go to the command line (Start > Run > cmd), traverse to the folder you want to list out (ie: cd c:/reallysweetfolder/) and type tree.
Your view will look something like this:

├───Browsers
│   ├───Minefield
│   ├───Mozilla Firefox
│   ├───Mozilla Firefox 2 Beta 2
│   └───Other
│       ├───Mozilla Firefox
│       ├───Netscape4
│       └───Opera

Now, of course you’d want to throw in some options (display files in the folders and list it out in ASCII characters) and export this to a text file right? Well, just type:

tree /f /a >c:/myFolderList.txt

Here’s the help for reference:

Graphically displays the folder structure of a drive or path.
TREE [drive:][path] [/F] [/A]

/F Display the names of the files in each folder.
/A Use ASCII instead of extended characters.

Author: Dirk Watkins

Dirk Watkins was born in Door County. He studied computer science and art at Carroll University in Waukesha, Wisconsin. Dirk now works as a web developer in Milwaukee programming mostly in C#, Javascript, T-SQL and the occasional regular expression. For design he likes to utilize as much standard CSS (positioning and styles) as possible. In his spare time Dirk brews beer, plays guitar, reads, listens to NPR, works on his house, and sleeps on quiet beaches.

One Comment

  1. You can also get a quick list of files in a folder and output the results to a text file with this command:

    dir /b > c:\output.csv

Leave a Reply

Required fields are marked *.

*