14

In Windows CMD, I use tree c: /f to get a tree of all directories resided in C:. But now I only want to tree out the only sub-directory folders (not files). How to I exclude files in tree command?

26

Leave out the "/F" switch, since it's what causes Files to be included.

From tree /?:

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.
| improve this answer | |
  • 1
    beat me to it... – Lamar B Dec 29 '11 at 3:09
  • @Ƭᴇcʜιᴇ007 Is there a way we can print this output to text or other file – Pravin Waychal Dec 1 '15 at 7:29
1

to output to txt file use command: (you will find in on drive C, as specified below)

tree /a > "C:\_TREE-Output.txt"
| improve this answer | |
  • 2
    This duplicates another answer and adds no new content. Please don't post an answer unless you actually have something new to contribute. – DavidPostill Mar 15 '16 at 9:55
  • 2
    It does provide more information though, there's the "store in file" with > part that the other answer doesn't have. – sokkyoku Aug 31 '16 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.