My google app script stop work after a certain times. the following code changes the file permission. in my folder there is like 10K files. when i run the script after changing 1~2K file sharing permission script stop work. is there anyway to solve the issue?
function myFunction() {
var folderId = "ID";
var files = DriveApp.getFolderById(folderId).getFiles();
var result = [];
while (files.hasNext()) {
var file = files.next();
file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
var temp = {
file_name: file.getName(),
url: "http://drive.google.com/uc?export=view&id=" + file.getId(),
};
result.push(temp);
};
}