提供意見
Class FileIterator
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
File Iterator
可讓指令碼遍歷可能包含大量檔案的集合的疊代器。您可以透過 Drive App
或 Folder
存取檔案疊代器。
// Log the name of every file in the user's Drive.
const files = DriveApp . getFiles ();
while ( files . hasNext ()) {
const file = files . next ();
Logger . log ( file . getName ());
}
內容詳盡的說明文件
get Continuation Token()
取得可用於稍後繼續執行此迭代的符記。如果在單一執行作業中處理迭代器會超過最大執行時間,此方法就很實用。接續符記的有效期限通常為一週。
回攻員
String
:可用於繼續此迭代作業的繼續符記,該符記會在產生符記時,保留在迭代器中的項目
has Next()
判斷呼叫 next()
是否會傳回項目。
回攻員
Boolean
:如果 next()
會傳回項目,則為 true
;否則為 false
next()
取得檔案或資料夾集合中的下一個項目。如果沒有任何項目,就會擲回例外狀況。
回攻員
File
:集合中的下一個項目
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[],[]]