Skip to content

Commit

Permalink
Where appropriate retrieves multiple pages when listing files
Browse files Browse the repository at this point in the history
  • Loading branch information
mberk committed Jul 14, 2015
1 parent 385b8b9 commit a4bfad1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,20 @@ func List(d *gdrive.Drive, query, titleFilter string, maxResults int, sharedStat
return err
}

files := list.Items

for(list.NextPageToken != "") {
caller.PageToken(list.NextPageToken)
list, err = caller.Do()
if err != nil {
return err
}
files = append(files,list.Items...)
}

items := make([]map[string]string, 0, 0)

for _, f := range list.Items {
for _, f := range files {
if f.DownloadUrl == "" && !includeDocs {
if f.MimeType != "application/vnd.google-apps.folder" {
continue
Expand Down

0 comments on commit a4bfad1

Please sign in to comment.