"Offering free computer help, hints, and tips to the Internet populace." Now with over 3,820 tips!

Windows XP and DOS

Display a Directory Tree of all Subdirectories and Files

SUMMARY: Display a directory's subdirectories and (optionally) all files contained therein.

Ever need to output a list of all the directories and subdirectories on a particular hard drive or removable media? The tree command does just that, and you can pipe the results to a text file for further manipulation or printing.

To view all of the directories and subdirectories on a device, just cd\ to the root of your drive and then execute the tree command. Else, only the subdirectories of the current directory will be displayed.

The following parameters modify the output:


This outputs all files contained in the current directory and subdirectories. Issuing this command from the root directory can show all non-hidden files on the current drive, so the output may be long!


By default, the treecommand uses simple graphics to signify subdirectories. If you are having trouble processing or printing the results, add this parameter to display ASCII characters.

The following example command, executed from the root directory of a hard drive or removable media, creates a text file tree.txt containing all non-hidden files and folders. This may take a while to process, so be patient!

tree /f > tree.txt

Return to the Windows XP and DOS page.

Print this tip

Get the Newsletter

blog comments powered by Disqus

Thanks For Sharing!

Newest Tips:

Windows 8
Speed up Your Taskbar Thumbnail Previews
General Computers
[MODIFIED] Why Do Install Programs Ask Me to Close Everything or Restart?
Screen Capture
[MODIFIED] Greenshot for Windows can Upload to Dropbox, Flickr, Picasa, and More
Google Chrome
[MODIFIED] View Memory and CPU Usage, Network Activity of Each Tab

Follow Us!

About MalekTips and the Author

The MalekTips website was created in 1998 by Andrew Malek of Envision Programming. The page's goal is to freely disperse computer-related tips, hints, and informative articles. Tips are organized to be easy to find, and are presented clearly, in easy-to-understand language. MalekTips also provides information and links to public-domain, open source, freeware, shareware, and commercial software available for download.