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

Forum Discussion

Nenciu D.'s avatar
Nenciu D.
New member | Level 1
10 years ago

Delete file from dropbox

I'm using Dropbox SDK v2 and I want to delete an item (folder or file) . Is it possible?

Thank you

9 Replies

Replies have been turned off for this discussion
  • arooran s.'s avatar
    arooran s.
    New member | Level 1
    9 years ago

    Once DeleteAsync method executed, in order to confirm that file is deleted or not i'm using a file meta data flag called isDeleted, but it return false when the file is removed from dropbox folder?

    var deleted = await dbx.Files.DeleteAsync(isFound.PathLower);
                     return deleted.IsDeleted

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    Arooran, thanks for the report! We'll look into it.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    Arooran, I looked into this, and this is the expected behavior. The delete call deletes a file or folder at the specified path. A success response indicates that the item was deleted. The returned metadata will be the metadata for the item that was deleted, but not an "IsDeleted" object (since the deleted version of metadata is less useful anyway).

  • arooran s.'s avatar
    arooran s.
    New member | Level 1
    9 years ago

    Gregory, Thanks for quick update. but what does the isDeleted meta data stands for? if the file is deleted it should set to true not false.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    This is definitely a little confusing in this case, but isDeleted just tells you if the returned Metadata object is of type DeletedMetdata, and not if the remote file is deleted. The delete method never returns a DeletedMetadata though, so isDeleted won't be true. You should instead use the call successfully completing as the indicator that the delete operation worked. 

About Dropbox API Support & Feedback

Node avatar for 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!