简体   繁体   中英

make a data file of google drive account using google drive api

I'am want to get all of my data in google drive into file (xml or json it's not so matter). the regular way to do it is like this:

Drive service = new Drive(somedata);
String fileName = service.get(fileId).execute().getTitle();

to get the file id, it's needed to do this:

Children.List request  = service.children().list(root);
ChildList children = request.execute();
String fileId = children.getItems().get(0).getId();

the problem is that the:

String fileName = service.get(fileId).execute().getTitle(); 

take very long time for each file.

and if I want to create a data file that contain all my data it's will take a lot of time.

I need the file name for the presentation of the file system of my google drive account.

anyone dealed with it and know waht to do?

Instead of children.list(root) do files.list(q='root' in parents, fields=nextPageToken, items/title) . That way you get all of your titles in a single (paginated) fetch.

NB. This is pseudo code. Look at the Java library for the exact syntax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM