cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

When listing files in a path using api v2, is there a limit of any kind ?

When listing files in a path using api v2, is there a limit of any kind ?

victorvlad
Explorer | Level 3
Go to solution

 

 

final DbxClientV2 dbxClient = dropboxService.getDropboxClient(user.getAccessToken());

        try {
            final ListFolderResult listResult = dbxClient.files()
                    .listFolderBuilder(path)
                    .withRecursive(true)
                    .start();

....
}dropboxListDebug.JPGdropboxListActualFolder.JPG

Using this piece of code, I get as a result a single folder but in reality that's not the case. This behavior just started to happen today. Up until today, the result contained all files/folders that actually exist in that path... so I was wondering if there is any limit in size or number of files based on which the result object is populated... 

 

The folder I'm trying to list from, contains 3.5K files, with a total of 7GB in size..

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

I see you're using listFolderBuilder, but aren't calling listFolderContinue. You aren't always guaranteed to get all entries returned by calling just listFolder. You need to check the result, and if ListFolderResult.hasMore is true, call back to listFolderContinue to get more results (and the same for the listFolderContinue result). You can find more information in the listFolder documentation.

Whether or not hasMore actually comes back as true in practice depends on a variety of factors that can change over time, per account, and per path.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

I see you're using listFolderBuilder, but aren't calling listFolderContinue. You aren't always guaranteed to get all entries returned by calling just listFolder. You need to check the result, and if ListFolderResult.hasMore is true, call back to listFolderContinue to get more results (and the same for the listFolderContinue result). You can find more information in the listFolder documentation.

Whether or not hasMore actually comes back as true in practice depends on a variety of factors that can change over time, per account, and per path.

victorvlad
Explorer | Level 3
Go to solution

hi Greg, 

Thanks for your quick reply. Indeed after looping on the .hasMore() i was able to get all my entries. So your suggestion fixed my problem. However, I am curious why did this behavior occur just now, since I've been using the approach you saw in my post for the last 2 years or so and I was getting all the entries in a single call.

-victor

Greg-DB
Dropbox Staff
Go to solution

The requirement to use listFolderContinue has always been part of API v2, but the amount of entries you get back per page can vary due to a number of things that can change over time. I can't say exactly what caused the change in this particular case, so just make sure you always have listFolderContinue implemented as documented so you can make sure to get everything.

victorvlad
Explorer | Level 3
Go to solution

Ok. Got it. Thanks ! Have a nice day !

-victor

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    victorvlad Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?