Вот код, который я использовал, и он, кажется, делает все, что хотел / нуждался:
function getFolders() {
var my_link = Browser.inputBox('Enter Folder Link', 'Paste a folder link below...', Browser.Buttons.OK);
var my_id = getIdFromUrl(my_link);
fcount = 2;
SpreadsheetApp.getActiveSpreadsheet().toast("Im looking for SLIDES.", "WORKING...",600);
generateFolderTree(my_id,MimeType.GOOGLE_SLIDES);
SpreadsheetApp.getActiveSpreadsheet().toast("Im looking for DOCS.", "WORKING...",600);
generateFolderTree(my_id,MimeType.GOOGLE_DOCS);
SpreadsheetApp.getActiveSpreadsheet().toast("Im looking for SHEETS.", "WORKING...",600);
generateFolderTree(my_id,MimeType.GOOGLE_SHEETS);
SpreadsheetApp.getActiveSpreadsheet().toast("Your search is complete!", "FINISHED!");
};
// -------------------------------------------------------------------------------
function generateFolderTree(my_id,type) {
var parentFolder = DriveApp.getFolderById(my_id);
var f = parentFolder.getFilesByType(type);
while (f.hasNext()) {
file = f.next();
display(file);
}
getChildFolders(parentFolder,type);
}
function getChildFolders(parent,type) {
var childFolders = parent.getFolders();
while (childFolders.hasNext()) {
var childFolder = childFolders.next();
var files = childFolder.getFilesByType(type);
while (files.hasNext()) {
mfs = files.next();
display(mfs);
}
getChildFolders(childFolder,type); // Recursive call for any sub-folders
}
}