Skip to content

Instantly share code, notes, and snippets.

@hiroto3432
Created December 8, 2017 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroto3432/9713d1df20c90c4cd2849d4060a09750 to your computer and use it in GitHub Desktop.
Save hiroto3432/9713d1df20c90c4cd2849d4060a09750 to your computer and use it in GitHub Desktop.
List<File> result = new ArrayList<>();
Files.List request = service.files().list();
do {
try {
FileList files = request.execute();
result.addAll(files.getItems());
request.setPageToken(files.getNextPageToken());
} catch (IOException e) {
System.out.println("An error occurred: " + e);
request.setPageToken(null);
}
} while (request.getPageToken() != null &&
request.getPageToken().length() > 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment