We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
pyraxic
7 years agoHelpful | Level 6
Dropbox API not returning all files
I am using Django and trying to get the list of all files. My dropbox contains 4149 files but it only returns 3998. Upon checking it seems that the most recent files uploaded to Dropbox isn't showing...
- 7 years ago
I tried running the code you posted and was able to reproduce the issue of it dropping the last page. Here's a fixed version:
dbx = dropbox.Dropbox(oauth_result.access_token) result = dbx.files_list_folder("", recursive=True) file_list = [] def process_entries(entries): for entry in entries: if isinstance(entry, dropbox.files.FileMetadata): file_list.append([entry.name]) process_entries(result.entries) while result.has_more: result = dbx.files_list_folder_continue(result.cursor) process_entries(result.entries) print(len(file_list))
Greg-DB
Dropbox Staff
For reference, where/how are you getting the 4149 number from?
Does it include folders by any chance? In your code, you're only picking out files. Folders would be `FolderMetadata`.
Also, note that it looks like your code wouldn't list any files if the account happens to only have one page worth of entries. I.e., it is possible for the first response's `has_more` to be `False`, in which case you wouldn't get to your `for` loop.
Does it include folders by any chance? In your code, you're only picking out files. Folders would be `FolderMetadata`.
Also, note that it looks like your code wouldn't list any files if the account happens to only have one page worth of entries. I.e., it is possible for the first response's `has_more` to be `False`, in which case you wouldn't get to your `for` loop.
pyraxic
7 years agoHelpful | Level 6
I am getting 4149 from dropbox web gui. I only have one folder called "/Camera". I selected all files and it shows that there are 4149 files in that folder. Even if I try to use the code
metadata = dbx.files_list_folder("/Camera", recursive=True)
It still shows 3998 files.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!