Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create empty folder on google drive?

I am trying to create empty folder for my android app..

File body = new File();

body.setTitle("title");

java.io.File fileContent = new java.io.File("title");

FileContent mediaContent = new FileContent("application/vnd.google-apps.folder", fileContent);

File file = service.files().insert(body, mediaContent).execute();

This doesnt seem to work.....

Getting exception:

java.io.FileNotFoundException:/title open failed ENOENT ( no such file or directory)

Caused by: libcore.io.ErrnoException: open failed: ENOENT (no such file or directory)

like image 411
anonymous Avatar asked Dec 01 '22 22:12

anonymous


1 Answers

Solved...

File body = new File();
body.setTitle("title");
body.setMimeType("application/vnd.google-apps.folder");
File file = service.files().insert(body).execute();

It will create folder named title in google drive.

like image 173
anonymous Avatar answered Dec 06 '22 03:12

anonymous