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()
나중에 이 반복을 재개하는 데 사용할 수 있는 토큰을 가져옵니다. 이 메서드는 한 번의 실행에서 반복자를 처리하면 최대 실행 시간이 초과되는 경우에 유용합니다.
연속 토큰은 일반적으로 일주일 동안 유효합니다.
리턴
String
: 토큰이 생성될 때 반복자에 남아 있던 항목으로 이 반복을 재개하는 데 사용할 수 있는 연속 토큰입니다.
hasNext()
next()
를 호출하면 항목이 반환되는지 여부를 결정합니다.
리턴
Boolean
: next()
가 항목을 반환하는 경우 true
이고 그렇지 않은 경우 false
입니다.
next()
파일 또는 폴더 모음에서 다음 항목을 가져옵니다. 항목이 남아 있지 않으면 예외가 발생합니다.
리턴
Folder
: 컬렉션의 다음 항목
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 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"]]