Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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 .filesListFolder({path: '/App'}) .then(response => { for (let i = 0; i < response.entries.length; i++) { dbx .filesDownload({path: `/App/${response.entries[i].name}`}) .then(resp => { let blob = resp.fileBlob; blob.name = response.entries[i].name; }); }
Is there a single API method that can simply fetch all content within a directory?
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));
With 'recursive' set to true, I get all the files and 'has_more' is equal to false. So I guess I don't need filesListFolderContinue. Although I'm getting all the files I'm only getting the metadata, I'm still trying to get the fileBlob to be able to retrieve the content within the file. With my original code, I was able to get fileBlob for each file, but it excluded each directory. Is there a way to get the fileBlob for both files and directories?
Is there no way to download the folder with the files in it instead of just the files?
Hi there!
If you need more help you can view your support options (expected response time for a 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!