diff --git a/scripts/rename-to-lowercase.js b/scripts/rename-to-lowercase.js index 4aa8223d7..4dc932ee0 100644 --- a/scripts/rename-to-lowercase.js +++ b/scripts/rename-to-lowercase.js @@ -3,21 +3,21 @@ const path = require("path"); const directoryPath = path.join(__dirname, "../domains"); -(async () => { +function renameFilesToLowercase() { // Read the files in the 'domains' directory - fs.readdirSync(directoryPath, (err, files) => { + fs.readdir(directoryPath, (err, files) => { if (err) { console.error("Error reading directory:", err); return; } - files.forEach(async (file) => { + 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.renameSync(oldPath, newPath, (err) => { + fs.rename(oldPath, newPath, (err) => { if (err) { console.error("Error renaming file:", err); } else { @@ -27,4 +27,6 @@ const directoryPath = path.join(__dirname, "../domains"); } }); }); -})(); +} + +renameFilesToLowercase();