Good day. I am trying to get all the files in the folder and subfolders and delete them, but the code does not work, it goes through only the first subfolder and there are no files in it, the script ends, please help.
function DeleteInvoices() {
var folder = DriveApp.getFolderById("1-2VAPBzEQxCaoN7KGSB_K_peiLIDk32e");
var fl = folder.getFolders();
while (fl.hasNext()) {
var files = fl.next();
Logger.log(files)
var fs = files.getFiles();
while (fs.hasNext()) {
var fss = fs.next();
fss.setTrashed(true)
}
}
}