Posted By

slvakumr on 10/30/14


Tagged

google script drive docs


Versions (?)

Check if a file exists in Google Drive


 / Published in: C++
 

Check if a file exists in Google Drive

  1. // Check if a file exists in google drive.
  2. // Author : Selva Kumar
  3. // Blog : slvakumr.com
  4. // Date : 30 October 2014
  5.  
  6. function CheckIfFileExists(name, mimeType){
  7. var flag = false;
  8. var files = DriveApp.getFilesByType(mimeType);
  9. while (files.hasNext()) {
  10. var file = files.next();
  11. if(file.getName() == name) {
  12. flag = true
  13. break;
  14. }
  15. }
  16. return flag;
  17. }

Report this snippet  

You need to login to post a comment.