Check if a file exists in Google Drive


/ Published in: C++
Save to your folder(s)

Check if a file exists in Google Drive


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.