0

Looking at the list_folder sandbox at dropbox.github.io/dropbox-api-v2-explorer/#files_list_folder

  1. I find no way to just return just the folders - basically where ".tag" = "folder" - I get all folders and files in one huge hunk the have to parse out the "folders"

  2. There is no way to easily parse the nested folders into some logical way so I can display a list with the sub folders indented in a display. such as Parent ID's would be helpful to match up children & parent folders

  3. no sorting features, such as 'name' 'created' to return them in name or created ASC/DESC order

Any help?

user94559
  • 59,196
  • 6
  • 103
  • 103
JMoskwa
  • 21
  • 1
  • 9
  • Do you have a question? The three facts you stated are correct. – user94559 Jul 15 '16 at 21:41
  • I guess for point #2, that data is already there... `/foo/bar` is a thing called `bar` with a parent of `/foo`. You'll have to split on slashes to build something like a tree hierarchy. – user94559 Jul 15 '16 at 21:42
  • It sounds like the actual/main question is "How can I list folders only?". Is that right? If so, the answer is currently no, but we'll consider it a feature request. As it stands, you'll need to filter and sort them on the client. – Greg Jul 16 '16 at 14:38
  • Thanks for the response – JMoskwa Jul 17 '16 at 16:42
  • Hey Greg, If there is a change where I can submit a query for just the folders, let me know in this post. It would be very helpful to get back just the list of folders vs ALL the files/folders in that folder -- especially when I just want to fill out the directory structure and there just so happens to be only 1 or no folders... I get back lots of what I then need to parse through only to find nothing... Thanks John – JMoskwa Oct 19 '16 at 00:10

1 Answers1

0

Best solution I could come up with to get only the folders back was this. It seems that when you perform a "2/files/list_folder" for a specific "path" and set all options to false. When you receive data back, iterate through the looking for .tag == "folder" and collect them. If you find an item that is not .tag == "folder", you can stop, you've collected all the folders for you specified "path". No need to perform a "2/files/list_folder/continue". Though it doesn't solve all my issues, this certainly goes a long way to solving my loading/searching time for folders.

JMoskwa
  • 21
  • 1
  • 9