cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

get list of folders

get list of folders

qazimuneeb1
Explorer | Level 3
Go to solution

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?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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 "".

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution

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 "".

qazimuneeb1
Explorer | Level 3
Go to solution

and what about the nested folders? Do we get them also?

Greg-DB
Dropbox Staff
Go to solution

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.

qazimuneeb1
Explorer | Level 3
Go to solution

any coded example for this? Would be really glad

Greg-DB
Dropbox Staff
Go to solution

I don't believe we have a full example of that, but it would look like this:

client.files().listFolderBuilder(path).withRecursive(true).start();
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    qazimuneeb1 Explorer | Level 3
What do Dropbox user levels mean?