Contents
  1. 1. OSX使用tree命令列出项目(文件夹树结构)
    1. 1.1. alias方式
    2. 1.2. 第三方tree命令

OSX使用tree命令列出项目(文件夹树结构)

alias方式

alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"

此种方式会遍历目录下的所有文件及其文件夹📂下的文件。

第三方tree命令

brew install tree

安装完成后在对应的项目目录或文件夹目录下使用tree-L参数指定遍历层级

将tree命令遍历的层级结构导出到readme.md文件中:

1
2
#README.md文件处于输入命令时同级目录下
tree -L 2 >README.md

示例:

tree -L 2
列出当前目录及其下一级目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# >tree -L 2
├── 403.html
├── 404.html
├── 500.html
├── AppMessagePush
│   ├── App\ Push.xlsx
│   ├── README.md
│   ├── apns-dist.pem
│   ├── appMsgPush.html
│   ├── ck_1019.pem
│   ├── resources
│   └── send2.php
├── AppPerformance
│   ├── README.md
│   ├── assets
│   ├── backup
│   ├── data
│   ├── demo.html
│   ├── index.html
│   ├── page-403.html
│   ├── page-404.html
│   └── page-500.html
├── IdCard
│   ├── README.md
│   ├── assets
│   └── index.html
├── JDBAPI
│   ├── 404.html
│   ├── API-xx.json
│   ├── API.json
│   ├── README.md
│   ├── admin-apiCheck.html
│   ├── admin-commonParams.html
│   ├── admin-form.html
│   ├── admin-index.html
│   ├── admin-table.html
│   ├── adminPanel
│   ├── assets
│   └── login.html
├── ProcessQualityReport
│   ├── README.md
│   ├── Temp
│   ├── app
│   ├── bower.json
│   ├── bower_components
│   ├── build
│   ├── data
│   ├── gulpfile.js
│   ├── node_modules
│   ├── package.json
│   └── reportTemplates
├── ProcessQualityReport_demo
│   ├── app
│   ├── bower.json
│   ├── bower_components
│   ├── dist
│   ├── gulpfile.js
│   ├── node_modules
│   ├── package.json
│   └── test
├── QRCode
│   ├── index.html
│   └── resources
├── api
│   ├── appMessagePush
│   ├── jenkins
│   ├── messageTips
│   ├── oAuth
│   ├── phpNotice
│   ├── processQualityReport
│   └── versionNotice
├── assets
│   ├── css
│   ├── image
│   └── js
├── favicon.ico
├── index.html
├── messageTips
│   ├── README.md
│   ├── index.html
│   └── resources
├── metro
│   ├── README.md
│   ├── animation
│   ├── css
│   ├── download.html
│   ├── image
│   ├── img
│   └── js
├── oAuth
│   ├── README.md
│   ├── assets
│   ├── index.html
│   ├── register.html
│   └── test
├── robots.txt
└── versionNotice
├── index.html
├── node
├── resources
├── simple.json
└── simpleTwo.json

53 directories, 48 files

tree -L 1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
├── 403.html
├── 404.html
├── 500.html
├── AppMessagePush
├── AppPerformance
├── IdCard
├── JDBAPI
├── ProcessQualityReport
├── ProcessQualityReport_demo
├── QRCode
├── api
├── assets
├── favicon.ico
├── index.html
├── messageTips
├── metro
├── oAuth
├── robots.txt
└── versionNotice

13 directories, 6 files

    
        
        版权声明:
        本文由Lomo创作和发表,采用署名(BY)-非商业性使用(NC)-相同方式共享(SA)国际许可协议进行许可,
        转载请注明作者及出处,本文作者为Lomo,本文标题为use tree command list project contents.
    
    


 Leave a message ^_^:

Contents
  1. 1. OSX使用tree命令列出项目(文件夹树结构)
    1. 1.1. alias方式
    2. 1.2. 第三方tree命令