Create Folder If It Does Not Exist In The Google Drive


Answer :

Files.List request = service.files().list().setQ(
"mimeType='application/vnd.google-apps.folder' and trashed=false");
FileList files = request.execute();


You could now go through all folders in "files" and check if any of the folders have the searched title.



Don't forget to loop through all pages with:



request.setPageToken(files.getNextPageToken());


Edit:



Maybe you could have a look at this site. You can add the title in your search criteria instead so you do not have to retrieve all the folders.



Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable