如何在CMD中获取文件夹树?


13

在Windows CMD中,我tree c: /f用来获取所有驻留在C:中的目录树。但是现在我只想树出唯一的子目录文件夹(而不是文件)。如何在树命令中排除文件?

Answers:


25

忽略“ / F”开关,因为这是导致包含文件的原因。

来自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.

1
击败我...
Lamar B

@Ƭᴇcʜιᴇ007有没有一种方法可以将此输出打印到文本或其他文件中
Pravin Waychal,2015年

1

要输出到txt文件,请使用以下命令:(您将在驱动器C中找到,如下所示)

tree /a > "C:\_TREE-Output.txt"

2
这将重复另一个答案,并且不添加任何新内容。除非您确实有新的贡献,否则请不要发布答案。
DavidPostill

2
它确实提供了更多信息,但其中包含“文件存储” >,而其他答案则没有。
sokkyoku
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.