google-apps-script DriveApp Get all files - put them into a continuation token - then retrieve them

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9


 function processGoogleDriveFiles() {
  var arrayAllFileNames,continuationToken,files,filesFromToken,fileIterator,thisFile;//Declare variable names
  arrayAllFileNames = [];//Create an empty array and assign it to this variable name
  files = DriveApp.getFiles();//Get all files from Google Drive in this account
  continuationToken = files.getContinuationToken();//Get the continuation token
  Utilities.sleep(18000);//Pause the code for 3 seconds
  filesFromToken = DriveApp.continueFileIterator(continuationToken);//Get the original files stored in the token
  files = null;//Delete the files that were stored in the original variable, to prove that the continuation token is working
  while (filesFromToken.hasNext()) {//If there is a next file, then continue looping
    thisFile =;//Get the next file
    arrayAllFileNames.push(thisFile.getName());//Get the name of the next file

Got any google-apps-script Question?