티스토리 뷰

반응형

개발 프로젝트를 포트폴리오로 정리할 때 폴더, 파일 구조가 필요할 때가 있다. 이럴 때 tree 명령어를 사용하면 쉽게 출력할 수 있다.

 

 

 

 

 

 

 

my-app
├── client
│   ├── public
│   │   ├── index.html
│   │   └── robots.txt
│   └── src
│       ├── App.js
│       ├── App.scss
│       ├── components
│       ├── index.js
│       ├── index.scss
│       └── setupTests.js
└── server
    └── index.js

 

 

기본 세팅

tree 설치

npm install -g tree-cli

 

 

 

주요 명령어

기본 명령어

npm tree

 

 

특정 폴더 제외

tree -I 폴더명

 

 

여러 폴더 제외

tree -I '폴더A|폴더B'

 

 

ex) 보통 node_modules 폴더와 build 폴더를 제외한다.

tree -I 'node_modules|build'

 

 

 

출력할 폴더 레벨(깊이) 지정

ex) 2단계 까지만 출력할 때

tree -L 2

 

 

파일 제외하고 폴더 구조만 출력

tree -d

 

my-app
├── client
│   ├── public
│   └── src
│       └── components
│           ├── Footer
│           ├── LandingPage
│           └── NavBar
└── server
    ├── config
    ├── middleware
    └── models

 

 

 

폴더 구조를 따로 파일로 내보내고 싶을 때

tree -o out.txt

 

 

 

반응형
반응형
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
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