Gscript đếm file && folder trong google drive

Làm cho thằng anh
mail@pastecode.io avatar
unknown
plain_text
3 years ago
528 B
4
Indexable
Never
function myFunction() {
  var files = DriveApp.getFiles();
  var count = 0 ;
  while(files.hasNext()){
    var file = files.next();
    Logger.log(file.getName());
    count++;
  }


  Logger.log("--------------------------");

  var foldels = DriveApp.getFolders();
  var count2 = 0 ;
  while(foldels.hasNext()){
   var folder = foldels.next();
   
    Logger.log("Folder Name: " + folder.getName());
    count2++;
  }
  Logger.log("Có " + count + " file");
  Logger.log("Có " + count2 + " folder");
}