Node.js выдаёт ошибку в коде, а конкретно ругается на строку: var folderPath = directoryPath + "\" + folders[i];
Вот он весь код:
var fs = require('fs');
// Step 1: Get the paths to all the folders inside the specified directory
var directoryPath = "D:\2 отправленое\АНАЛИЗ";
var folders = fs.readdirSync(directoryPath);
// Step 2: Sort the list in descending order based on the numbers in the folder names
folders.sort(function(a, b) {
var aNumber = parseInt(a.match(/^\d+/)[0]);
var bNumber = parseInt(b.match(/^\d+/)[0]);
return bNumber - aNumber;
});
// Step 3: Find the first empty folder with a size greater than or equal to 100 million bytes
var pytkpystoypapke = "";
for (var i = 0; i < folders.length; i++) {
var folderPath = directoryPath + "\" + folders[i];
var folderSize = fs.statSync(folderPath).size;
if (folderSize >= 100000000 && fs.readdirSync(folderPath).length == 0) {
pytkpystoypapke = folderPath;
break;
}
}
[[ITOG]] = pytkpystoypapke