当前位置:网站首页>文件夹目录结构自动生成
文件夹目录结构自动生成
2022-06-12 11:36:00 【achi010】
前言
写文章的时候,经常会需要说明文件家的目录结构。如果手动打印输出,排版繁琐、容易出错,自动化怎么搞?
一、结果示例
C:.
└─node_modules
├─npm
│ ├─.github
│ │ ├─ISSUE_TEMPLATE
│ │ └─workflows
│ ├─bin
│ │ └─node-gyp-bin
│ ├─changelogs
│ ├─docs
│ │ ├─content
│ │ │ ├─cli-commands
│ │ │ ├─configuring-npm
│ │ │ └─using-npm
│ │ └─src
│ │ ├─components
│ │ │ └─home
│ │ ├─images
│ │ ├─pages
│ │ └─templates
│ ├─lib
│ │ ├─auth
│ │ ├─config
│ │ ├─doctor
│ │ ├─install
│ │ │ └─action
│ │ ├─search
│ │ └─utils
二、Windows 11
操作系统: Windows 11 & 10
Windows 系统 tree 命令,可通过该命令实现。
示例
Windows 11 示例如下
简单使用
C:\Programming\nodejs>tree
卷 Windows-SSD 的文件夹 PATH 列表
卷序列号为 4288-DA87
C:.
└─node_modules
├─npm
│ ├─.github
│ │ ├─ISSUE_TEMPLATE
│ │ └─workflows
│ ├─bin
│ │ └─node-gyp-bin
│ ├─changelogs
│ ├─docs
帮助
# 帮助
C:\Programming\nodejs>tree /?
以图形显示驱动器或路径的文件夹结构。
TREE [drive:][path] [/F] [/A]
/F 显示每个文件夹中文件的名称。
/A 使用 ASCII 字符,而不使用扩展字符。
结果输出到文件
C:\Programming\nodejs>tree > demo.md
三、node.js 的 tree
操作系统: CentOS Linux release 7.9.2009 (Core)
node.js: v16.15.0
1.node.js
# 下载
wget https://cdn.npmmirror.com/binaries/node/v16.15.0/node-v16.15.0-linux
-x64.tar.xz
# 解压
tar -xvf node-v16.15.0-linux-x64.tar.xz
# 配置(不配置也可,能找到命令目录即可)
ln -s /node-v16.15.0-linux-x64/bin/npm /usr/local/bin
ln -s /node-v16.15.0-linux-x64/bin/node /usr/local/bin
# 验证配置是否成功
node -v
nopm -v
2.tree
安装 tree
# 全局安装 tree
npm i tree-node-cli -g
# 安装完之后,node 所在目录会增加 tree
/node-v16.15.0-linux-x64/bin/tree
# 配置
ln -s /node-v16.15.0-linux-x64/bin/tree /usr/local/bin
# 验证配置
tree -V
文件夹目录结构自动生成,并输出到文件
# 示例
tree -L 2 > README.md
# 结果
node-v16.15.0-linux-x64
├── CHANGELOG.md
├── LICENSE
├── README.md
├── bin
│ ├── README.md
│ ├── corepack
│ ├── node
│ ├── npm
│ ├── npx
│ ├── tree
│ └── treee
├── include
│ └── node
├── lib
│ └── node_modules
└── share
├── doc
├── man
└── systemtap
# 帮助
tree -h
PS : 对比之下,感觉 Windows 的 tree 就是个渣渣。Windows 也可以使用 node 的这个方法,配置方法是一样的。
Windows 安装配置 node 可以参考
总结
其实方法比较简单。关键是要找对方法~~!!!
边栏推荐
- Naming specification / annotation specification / logical specification
- 当自己有台服务器之后
- Les humains veulent de l'argent, du pouvoir, de la beauté, de l'immortalité, du bonheur... Mais les tortues ne veulent être qu'une tortue.
- Unlimited growth, we will all go to the future | the 15th anniversary of the founding of InfoQ China
- DS18B20 digital thermometer (I) electrical characteristics, parasitic power supply mode and remote wiring
- LVS health state detection based on application layer
- Pytoch notes
- ReentrantLock源码分析
- C# 37. Textbox scroll bar and multiline
- 记录一下使用JPA时遇到的坑
猜你喜欢

Problems in cross validation code of 10% discount

6.6 RL:MDP及奖励函数

CLJ3-100ALH30剩余电流继电器

ReentrantLock源码分析

多普勒效应的基本原理

Windows10 install mysql-8.0.28-winx64

网络的拓扑结构

MCUXpresso开发NXP RT1060(3)——移植LVGL到NXP RT1060

Face recognition PIP failed to install Dlib Library

InfoQ geek media's 15th anniversary solicitation |position:fixed virtual button cannot take effect after being triggered. Problem analysis and Solution Exploration
随机推荐
AI - face
CLJ3-100ALH30剩余电流继电器
Drqueueonrails integrated LDAP authentication
redis 总结
NLP data set download address for naturallanguageprocessing
ReentrantLock源码分析
Basic principle of Doppler effect
Selenium uses proxy IP
记录一下使用JPA时遇到的坑
arm各种交叉编译工具的区别
B+ 树的简单认识
Clickhouse column basic data type description
Arm cross compilation chain download address
(37) How bee uses different data source instances at the same time
VirtualBox virtual machine shut down due to abnormal system. The virtual machine startup item is missing
Heavyweight proxy cache server squid
Network topology
Reading mysql45 lecture - self summary (part)
AcWing 1921. 重新排列奶牛(环图)
[Blue Bridge Cup SCM 11th National race]