We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
qazimuneeb1
6 years agoExplorer | Level 3
get list of folders
Hi. I want to get a list of folders along with path inside my dropbox so that i can upload my files to defined path through my own made android application. Is there any way to get folders list without clicking each folder and get path? I mean get list of folders along with path when i initiate DbxClientV2? or any other way so i can select path from my app when uploading file to specific path?
Yes, using the Dropbox Java SDK, you can get the list of files/folders under any particular path using the listFolder/listFolderContinue methods. The result will contain a list of Metadata objects, from which you can get the paths for the referenced items. There's an example of calling listFolder here. As shown there, to list the root folder itself, you would supply a path value of the empty string "".
5 Replies
- Greg-DB6 years ago
Dropbox Community Moderator
Yes, using the Dropbox Java SDK, you can get the list of files/folders under any particular path using the listFolder/listFolderContinue methods. The result will contain a list of Metadata objects, from which you can get the paths for the referenced items. There's an example of calling listFolder here. As shown there, to list the root folder itself, you would supply a path value of the empty string "".
- qazimuneeb16 years agoExplorer | Level 3
and what about the nested folders? Do we get them also?
- Greg-DB6 years ago
Dropbox Community Moderator
You can use listFolderBuilder to get a ListFolderBuilder you can use and call withRecursive(true) to do a recursive listing if you wish. That would include nested items.
Or, to just list the contents of particular nested folder when needed, you can use listFolder/listFolderContinue again with the path of the folder you want to list.
- qazimuneeb16 years agoExplorer | Level 3
any coded example for this? Would be really glad
- Greg-DB6 years ago
Dropbox Community Moderator
I don't believe we have a full example of that, but it would look like this:
client.files().listFolderBuilder(path).withRecursive(true).start();
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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!