update project root,
This commit is contained in:
32
scripts/clean.js
Normal file
32
scripts/clean.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
function removeZoneIdentifier(dir) {
|
||||
fs.readdirSync(dir).forEach((file) => {
|
||||
const filePath = path.join(dir, file);
|
||||
if (fs.lstatSync(filePath).isDirectory()) {
|
||||
removeZoneIdentifier(filePath); // 递归处理子目录
|
||||
} else {
|
||||
// const newFilePath = filePath.replace(/\.Zone\.Identifier$/, "");
|
||||
// if (newFilePath !== filePath) {
|
||||
// console.log(`removing ${filePath}`);
|
||||
// }
|
||||
if (filePath.search(/:Zone\.Identifier$/) > -1) {
|
||||
fs.unlinkSync(filePath); // 删除文件而不是重命名
|
||||
console.log("removing ", filePath);
|
||||
}
|
||||
if (filePath.search(/.bak$/) > -1) {
|
||||
fs.unlinkSync(filePath); // 删除文件而不是重命名
|
||||
console.log("removing ", filePath);
|
||||
}
|
||||
|
||||
if (filePath.search(/.del$/) > -1) {
|
||||
fs.unlinkSync(filePath); // 删除文件而不是重命名
|
||||
console.log("removing ", filePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
removeZoneIdentifier(process.cwd());
|
||||
console.log("done");
|
Reference in New Issue
Block a user