Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Rahul M.1's avatar
Rahul M.1
New member | Level 1
10 years ago

How to check if a file or folder exists on Dropbox in the new Dropbox iOS SDK which is now available ?

I see some responses of checking if the file exists via DBFileSystem over internet, but this was in Sync API which is not available now. There is nothing I am able to find the new DropboxSDK.framework for checking if a file or folder exists before creating a new one. I can use tricks to do this, but is there any official method to do this ? Further, I've tried to use a trick of loading metadata for a non-existent path to see if an error comes in response which can be used to determine the specific file or folder does not exist. But, the Dropbox SDK fails saying that it is not able to create the path for query as it is not existing. However, this message is only seen as a warning and not in any callback to act upon. Can anyone help on this ?

2 Replies

Replies have been turned off for this discussion
  • I think you're on the right track. You should call loadMetadata on the path you're interested in, and then the loadMetadataFailedWithError method on your delegate should be invoked with the error that the path doesn't exist. See https://www.dropbox.com/developers/core/start/ios#listing.

  • Rahul M.1's avatar
    Rahul M.1
    New member | Level 1
    10 years ago

    Steve,
    I've tried loadMetaData method, it is calling the delegate and showing proper error. Yesterday, it wasn't getting called and SDK was only throwing warning and silently failing. Could be my mistake somewhere. Thanks and sorry for bothering on such small stuff.

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!