<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dropbox API not returning all files in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258744#M15007</link>
    <description>Thanks! I just took another look at your code, and it looks like it actually won't process the last page of results. That is, the last call to `files_list_folder_continue` will cause `m2.has_more` to be `False`, which will terminate your `while` loop before that final `m2.entries` is processed. You'll just need to restructure the code to avoid that. (E.g., only put `files_list_folder_continue` at the top of `while` loop, or something to that effect.)</description>
    <pubDate>Wed, 03 Jan 2018 15:51:23 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2018-01-03T15:51:23Z</dc:date>
    <item>
      <title>Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258423#M14992</link>
      <description>&lt;P&gt;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 up in the list. Here is my code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    dbx = dropbox.Dropbox(oauth_result.access_token)
    metadata = dbx.files_list_folder("", recursive=True)
    flist = []
    if metadata.has_more == True:
        m1 = metadata.entries
        cur = metadata.cursor
        for i in m1:
            if isinstance(i, dropbox.files.FileMetadata):
                flist.append([i.name])
        m2 = dbx.files_list_folder_continue(cur)
        while m2.has_more == True:
            for i in m2.entries:
                if isinstance(i, dropbox.files.FileMetadata):
                    flist.append([i.name])
            cur = m2.cursor
            m2 = dbx.files_list_folder_continue(cur)&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 09:16:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258423#M14992</guid>
      <dc:creator>pyraxic</dc:creator>
      <dc:date>2019-05-29T09:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258571#M14996</link>
      <description>For reference, where/how are you getting the 4149 number from? &lt;BR /&gt;&lt;BR /&gt;Does it include folders by any chance? In your code, you're only picking out files. Folders would be `FolderMetadata`.&lt;BR /&gt;&lt;BR /&gt;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.</description>
      <pubDate>Tue, 02 Jan 2018 15:46:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258571#M14996</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-01-02T15:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258635#M15002</link>
      <description>&lt;P&gt;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&lt;/P&gt;
&lt;PRE&gt; metadata = dbx.files_list_folder("/Camera", recursive=True)&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;It still shows 3998 files.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 23:01:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258635#M15002</guid>
      <dc:creator>pyraxic</dc:creator>
      <dc:date>2018-01-02T23:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258744#M15007</link>
      <description>Thanks! I just took another look at your code, and it looks like it actually won't process the last page of results. That is, the last call to `files_list_folder_continue` will cause `m2.has_more` to be `False`, which will terminate your `while` loop before that final `m2.entries` is processed. You'll just need to restructure the code to avoid that. (E.g., only put `files_list_folder_continue` at the top of `while` loop, or something to that effect.)</description>
      <pubDate>Wed, 03 Jan 2018 15:51:23 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258744#M15007</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-01-03T15:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258821#M15021</link>
      <description>&lt;P&gt;Hi Greg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;files_list_folders_continue() is already outside of the while loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;m2 = dbx.files_list_folder_continue(cur)
        while m2.has_more == True:
            for i in m2.entries:
                if isinstance(i, dropbox.files.FileMetadata):
                    flist.append(i.name)
            cur = m2.cursor
            m2 = dbx.files_list_folder_continue(cur)&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jan 2018 22:06:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258821#M15021</guid>
      <dc:creator>pyraxic</dc:creator>
      <dc:date>2018-01-03T22:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258828#M15022</link>
      <description>I'm referring to the second call to files_list_folder_continue at the end of the while loop.</description>
      <pubDate>Wed, 03 Jan 2018 22:53:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258828#M15022</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-01-03T22:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258845#M15024</link>
      <description>&lt;P&gt;Even putting it outside of while loop didn't make any difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        m2 = dbx.files_list_folder_continue(cur)
        while m2.has_more == True:
            for i in m2.entries:
                if isinstance(i, dropbox.files.FileMetadata):
                    flist.append(i.name)
            cur = m2.cursor
        m2 = dbx.files_list_folder_continue(cur)
    return render(request, 'accounts/dropbox.html', {'flist': flist})&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:54:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/258845#M15024</guid>
      <dc:creator>pyraxic</dc:creator>
      <dc:date>2018-01-04T05:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/259051#M15045</link>
      <description>&lt;P&gt;I even changed that to outside of loop but same results.&amp;nbsp;It doesn't seem to be getting to the while loop at all.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 08:23:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/259051#M15045</guid>
      <dc:creator>pyraxic</dc:creator>
      <dc:date>2018-01-05T08:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/259122#M15052</link>
      <description>&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;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))
&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jan 2018 15:53:04 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/259122#M15052</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-01-05T15:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API not returning all files</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/259223#M15067</link>
      <description>&lt;P&gt;Thank you!! It works.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jan 2018 08:44:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-not-returning-all-files/m-p/259223#M15067</guid>
      <dc:creator>pyraxic</dc:creator>
      <dc:date>2018-01-07T08:44:51Z</dc:date>
    </item>
  </channel>
</rss>

