如何產生網路上常見的目錄樹狀結構?


在網路上常見如下 Example 結構稱為目錄樹狀結構

Example

└── yolov7
    ├── datasets
    │   └── VisDrone
    │       ├── train
    │       │   ├── images
    │       │   ├── labels
    │       │   └── labels.cache
    │       └── val
    │           ├── images
    │           ├── labels
    │           └── labels.cache
    └── yolov7-master


接著就來介紹如何產生目錄樹狀結構

1. 開啟 Windows PowerShellCommand Prompt 命令視窗。


2. 先輸入 tree /? 來查看有哪些參數可用。

PS D:\> 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.

PS D:\>


訊息寫著

Graphically displays the folder structure of a drive or path.

以圖形方式顯示驅動器或路徑的資料夾結構。


Syntax :

PS D:\> tree [/F] [/A] [drive:][path] [> [drive:][path]]

Parameters :

  • /F : 在每個文件夾中顯示文件的名稱。
  • /A : 使用ASCII而不是擴展字符。
  • > : 將 D:/Newfolder 目錄產生的樹狀結構導出到指定的路徑,並且儲存成 .txt 檔案 (ex: D:/MyTree.txt)。


Example #1

PS D:\> tree /F D:/Newfolder > D:/MyTree.txt


Example #2

目錄或檔案名稱有空格,記得使用單引號,ex: 'D:/New folder' or 'D:/My Tree.txt'

PS D:\> tree /F 'D:/New folder' > 'D:/My Tree.txt'


Example #3

PS D:\> tree /F D:/Newfolder
創作者介紹
創作者 香腸炒章魚 的頭像
mitblog

香腸炒章魚

mitblog 發表在 痞客邦 留言(0) 人氣( 569 )