You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

pyraxic's avatar
pyraxic
Helpful | Level 6
7 years ago

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...
  • Greg-DB's avatar
    Greg-DB
    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))