I use the Google Apps Script function DriveApp to iterate through 425 folders. The function handles one folder each run and saves the continuationToken as a UserProperty. It runs every minute.
My problem is that after many runs (~300) the continuationToken is the same as the previous one making a loop that I cant get past.
I have made this script in many different ways but the token-issue always occur and for different folders. Even when I handled multiple folders per run.
This is basically what I do:
function name(){
var proper = PropertiesService.getUserProperties();
var alla = proper.getProperty('addLoop');
if(alla == "")
alla = DriveApp.getFolderById("ID").getFolders();
else
alla = DriveApp.continueFolderIterator(alla);
if(alla.hasNext()){
var next = alla.next();
proper.setProperty('addLoop', alla.getContinuationToken());
functionName(next);
}
else
proper.setProperty('addLoop', "");
}
I can't believe this is a scripting-error but i haven't read of any limitation for this usage of the Apps Script either... I'm clueless and happy for any input.