We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
bbongrip
8 years agoHelpful | Level 6
search dropbox folder
can anybody tell me a way to search a specific folder in dropbox to populate an array of strings with the filenames in that folder? Im trying to implement a way for users to search for a file in a dropbox folder.
- I finally got it! lol Thank you so much for you time and help. It has been greatly appreciated and a learning experience for me. I ended up using "//" as my path and it works perfect.
Cheers!
Kevin
- Greg-DBDropbox StaffUsing the Dropbox API, you can search for files and folders under a particular path using the /2/files/search endpoint:
https://www.dropbox.com/developers/documentation/http/documentation#files-search
If you're using an official SDK, there will be a corresponding search method for that.- bbongripHelpful | Level 6thanks again greg. however I'm not really understanding how i would be able to search for all the filenames within a specific dropbox folder, and add those filenames to an array of strings, to then use as a base for my user to search for a specific string in that array. sorry if I'm not making to much sense. this is all very new to me. FYI - I'm using swift 3
- Greg-DBDropbox Staff
Since you're using Swift, are you using the official SwiftyDropbox SDK? In that case, you'd use the search method in FilesRoutes. As long as the call succeeds, it will return a SearchResult. You can then use the SearchResult.matches, which is an array of SearchMatch. SearchMatch.metadata contains the FileMetadata for the match, which contains the name, pathDisplay, etc.
Give that a try and let us know if you run in to any issues.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 2 months agoIf 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 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!