Created
January 2, 2019 16:35
-
-
Save erajanraja24/294826a4be84e2631f22c3736dc476ee to your computer and use it in GitHub Desktop.
Get file, folder by ID, create folder, Search folder and ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFilesAndFolder() { | |
//Get File by ID | |
var file=DriveApp.getFileById("1_eYdGILxexc7JVJGeKjdcGk-lSwawHTgb12boCWIfF4"); | |
Logger.log(file) | |
//Get Folder by ID and get list of files inside it | |
var files=DriveApp.getFolderById("0Bz7xEwadCXkXSUVhODdGRHVnUkk").getFiles(); | |
while(files.hasNext()) | |
{ | |
Logger.log(files.next()) | |
} | |
//Create Folder | |
DriveApp.createFolder("Apps Script") | |
//Search Folder by contain logic | |
var folder=DriveApp.searchFolders("title contains 'youtube'"); | |
while(folder.hasNext()) | |
{ | |
Logger.log(folder.next()) | |
} | |
//search File by mime Type | |
var files=DriveApp.searchFiles("mimeType contains 'image/' and title contains 'img'"); | |
while(files.hasNext()) | |
{ | |
Logger.log(files.next()) | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment