输入
$ tree
输出
.
├── dist
├── index.css
├── index.html
├── index.js
└── node_modules
2 directories, 3 files
假设目录下存在index.html, index.css, index.js, node_modules 等文件或目录。
利用 find 命令找出当前目录下不包含node_moduels的文件或文件夹
输入
$ find . -maxdepth 1 -not -name node_moduels
输出
./dist
./index.css
./index.html
./index.js
利用 find 命令将目录下非node_modules的文件或目录复制到dist目录。
$ find . -maxdepth1 -not -name node_modules -not -name dist|xargs -J % cp -r % dist
查看结果
$ ls dist
输出
index.css index.html index.js