Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
philip-lf
7 years agoExplorer | Level 4
Dropbox API to download All Content
Hi there, I am trying to fetch all content within a certain directory and display its content. The way it's set up now, it can fetch all files, but not directories within this directory.
dbx
....
- 7 years ago
The only way to download an entire folder at once like that is via filesDownloadZip.
Greg-DB
Dropbox Community Moderator
7 years agoThere isn't a single method to retrieve everything. The interface is paginated in order to support folders with many items. (Otherwise, calls would start breaking when there are very large lists to return.)
So, in order to retrieve everything, you need to use both filesListFolder and filesListFolderContinue as documented:
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolder__anchor
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolderContinue__anchor
Also, if you want nested entries, you can set recursive=true when calling filesListFolder:
https://dropbox.github.io/dropbox-sdk-js/global.html#FilesListFolderArg
So, in order to retrieve everything, you need to use both filesListFolder and filesListFolderContinue as documented:
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolder__anchor
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolderContinue__anchor
Also, if you want nested entries, you can set recursive=true when calling filesListFolder:
https://dropbox.github.io/dropbox-sdk-js/global.html#FilesListFolderArg
philip-lf
7 years agoExplorer | Level 4
Thanks for the response Greg. As I'm trying it out, I can't seem to get the response I want. Am I not calling the API correctly?
dbx
.filesListFolder({path: '/App', recursive: true})
.then(response => {
console.log(response.entries); // works
dbx
.filesListFolderContinue({cursor: response.cursor})
.then(resp => {
console.log(resp.entries); // empty array
});
})
.catch(error => console.error(error));About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!