Class FolderIterator
フォルダイテレータスクリプトで大規模なフォルダ コレクションを反復処理できるようにするオブジェクト。フォルダ イテレータには、DriveApp
、File
、または Folder
からアクセスできます。
// Log the name of every folder in the user's Drive.
const folders = DriveApp.getFolders();
while (folders.hasNext()) {
const folder = folders.next();
Logger.log(folder.getName());
}
詳細なドキュメント
getContinuationToken()
このイテレーションを後で再開するために使用できるトークンを取得します。この方法は、1 回の実行でイテレータを処理すると最大実行時間が超過する場合に便利です。通常、連続トークンの有効期間は 1 週間です。
戻る
String
- トークンが生成されたときにイテレータに残っていたアイテムを使用して、この反復処理を再開するために使用できる連続トークン
hasNext()
next()
の呼び出しでアイテムが返されるかどうかを判断します。
戻る
Boolean
- next()
がアイテムを返す場合は true
、返さない場合は false
next()
ファイルまたはフォルダのコレクション内の次のアイテムを取得します。アイテムが残っていない場合は例外をスローします。
戻る
Folder
- コレクション内の次のアイテム
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-12-22 UTC。
[null,null,["最終更新日 2024-12-22 UTC。"],[[["`FolderIterator` enables scripts to iterate through a large collection of folders within Google Drive."],["It provides methods like `hasNext()` to check for more folders, `next()` to retrieve the next folder, and `getContinuationToken()` for handling lengthy iterations."],["Developers can utilize `FolderIterator` with `DriveApp`, `File`, or `Folder` objects to access and process folders programmatically."]]],["FolderIterator allows iterating over a large collection of folders. Key actions include using `hasNext()` to check for the next item and `next()` to retrieve it. `getContinuationToken()` provides a token to resume iteration later, helpful for large collections. The example shows how to log every folder's name in a user's Drive, demonstrating iteration through the folder collection. The iterator returns folder objects and can throw an exception if no items remain.\n"]]