当我tree /a /f > output.txt在 Windows 的 cmd 中运行时,我得到了一个格式很好的目录结构。但是目录列表没有任何特定的顺序。如何让树按字母顺序对文件夹和文件进行排序?
注意:我需要将输出格式化为层次结构,因此使用dir可能还不够。我可能需要使用tree.
摘录自 tree 的输出
+---HCM Documents
| +---Interfaces
| +---Process Flows
| +---Workshops
| | \---Overviews
| +---Approvals
| +---Requirements
| \---Misc
+---Testing Documents
+---Communications
| +---Statuses
| +---Meeting Minutes
+---Finance Documents
| +---Taxes
| +---General Ledger
| +---Business
| +---Process Flows
| +---Purchases
| \---Workshops
+---Unfiled
+---Infrastructure Documents
+---Financials
| +---Issue and Risk Log
| +---Timelines
| +---Templates
| \---Decisions Log
Run Code Online (Sandbox Code Playgroud)
请注意,文件夹名称不是按字母顺序排列的。它们也不是按照修改日期或大小的顺序,或者我能想到的任何其他顺序。
此外,这是我在dir …