Delete scripts directory

This commit is contained in:
William Harrison
2024-11-09 21:25:53 +08:00
committed by GitHub
parent 074b7e2aae
commit 58f3d5b920
-32
View File
@@ -1,32 +0,0 @@
const fs = require("fs");
const path = require("path");
const directoryPath = path.join(__dirname, "../domains");
function renameFilesToLowercase() {
// Read the files in the 'domains' directory
fs.readdir(directoryPath, (err, files) => {
if (err) {
console.error("Error reading directory:", err);
return;
}
files.forEach((file) => {
const oldPath = path.join(directoryPath, file);
const newPath = path.join(directoryPath, file.toLowerCase());
// Only rename if the file name is not already in lowercase
if (oldPath !== newPath) {
fs.rename(oldPath, newPath, (err) => {
if (err) {
console.error("Error renaming file:", err);
} else {
console.log(`Renamed: ${file} -> ${file.toLowerCase()}`);
}
});
}
});
});
}
renameFilesToLowercase();