Answer the question
In order to leave comments, you need to log in
How to exclude a folder from Google app script search in Google drive?
Good afternoon! This script allows you to display all the folders and what is in them.
function getFolderList() {
var folders = DriveApp.getFolders();
while (folders.hasNext()) {
var folder = folders.next();
var files = folder.getFiles();
Logger.log(folder.getName());
while(files.hasNext()){
var file = files.next();
Logger.log(file.getName());
}
}
}
Answer the question
In order to leave comments, you need to log in
Obviously you need to get the name or id of the folder, and check what is not equal to the condition
function getFolderList() {
const folders = DriveApp.getFolders();
while (folders.hasNext()) {
let folder = folders.next();
folder = folder.getId()
if (folder != '123') {
const files = folder.getFiles();
Logger.log(folder.getName());
while (files.hasNext()) {
const file = files.next();
Logger.log(file.getName());
}
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question