11 Star 106 Fork 28

liuhll/silky

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
delete-bin-obj-folders.js 885 Bytes
一键复制 编辑 原始数据 按行查看 历史
liuhll 提交于 2021-10-28 15:48 . 新增删除 bin obj目录脚本
const { resolve } = require("path");
const { readdir, rmdir } = require("fs").promises;
async function* removeFolder(dir) {
await rmdir(dir, { recursive: true });
yield dir;
}
async function* getBinObj(dir) {
const dirents = await readdir(dir, { withFileTypes: true });
for (const dirent of dirents) {
if (!dirent.isDirectory()) continue;
const name = dirent.name;
if (name === "node_modules") continue;
const res = resolve(dir, dirent.name);
if (name === "bin" || name === "obj") {
yield* removeFolder(res);
continue;
}
yield* getBinObj(res);
}
}
(async () => {
console.log("\x1b[36m%s\x1b[0m", "Deleting all BIN and OBJ folders...");
for await (const dir of getBinObj(".")) {
console.log("\x1b[33m%s\x1b[0m", `Removed: ${dir}`);
}
console.log("\x1b[36m%s\x1b[0m", "All BIN and OBJ folders are deleted.");
})();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/liuhll2/silky.git
[email protected]:liuhll2/silky.git
liuhll2
silky
silky
main

搜索帮助