Skip to content

Instantly share code, notes, and snippets.

@pizzacat83
Last active December 4, 2018 04:54
Show Gist options
  • Save pizzacat83/864cebf4f366f32ff15601a037c400d1 to your computer and use it in GitHub Desktop.
Save pizzacat83/864cebf4f366f32ff15601a037c400d1 to your computer and use it in GitHub Desktop.
var properties = PropertiesService.getScriptProperties();
var TARGET_ROOT_ID = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // ルート
var TARGET_FREQ_ID = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // よく更新されるフォルダ
var rootFolder = DriveApp.getFolderById(TARGET_ROOT_ID);
var ct = properties.getProperty('updateCheck.rootContinuationToken');
var itr = ct ? DriveApp.continueFolderIterator(ct) : rootFolder.getFolders();
var id;
do{
if(itr.hasNext()){
// つぎのフォルダがある
targetFolder = itr.next();
}else{
// つぎのフォルダはない
itr = rootFolder.getFolders();
}
id = targetFolder.getId();
} while(id == TARGET_FREQ_ID || JSON.parse(properties.getProperty('updateCheck.muteFolderList')).indexOf(id)!=1)
properties.setProperty('updateCheck.rootContinuationToken', itr.getContinuationToken());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment