Skip to main content

How can I delete a folder from the Media Library?

Comments

10 comments

  • Karl Johan Kleist

    I just tried to delete an empty folder from the media library. But this fails, I just get this following pop-up over and over again:

    "Confirm Deletion

    Are you sure you want to delete this folder?"

    1
  • Nadav Ofir

    Hi,

    Can't see an empty folder on your account.
    Did you succeed deleting it?

    If you're still encountering an issue, please share some more information regarding the exact folder so we can check it out on your account,

    If you care about privacy, please feel free opening a support ticket:
    http://support.cloudinary.com/tickets/new

    0
  • Karl Johan Kleist

    Thanks for for your assistance.

    I finally managed to delete the folder, some hour later.

    The folder had been renamed earlier on (implicitly, by renaming an image). May a cache somewhere that does not properly invalidate?

    0
  • Finalsite Development

    I'm having a problem with this. The folders(s) that I'm trying to delete via the trash can icon in the admin are empty but it appears that the AJAX is making a call to an incorrect URL:


    DELETE https://cloudinary.com/console/media_library/subfolders 404 (Not Found)


    I suspect that the lookup for the specified folder is failing and returning this 404 error because hitting the above URL successfully redirects to https://cloudinary.com/console/media_library


    I inspected the path being sent in the form data of the AJAX request and it appears to be correct but it's a relative path instead of an absolute path. I'm not sure if that would make any difference on the backend.

    0
  • Nadav Ofir

    Seems like you're trying to delete a folder that contains backups of previously deleted resources. If you wish to clear your backup, please contact us via support@cloudinary.com
    We'll look into improving the messaging in such error cases.

    0
  • Vanitha

    Unable to delete my empty folder. Please help me to fix this. Thanks,

    0
  • Roee Ben Ari

    Hi Vanitha, if the folder contains backup entries for deleted resources then it cannot be deleted. In order to fully delete the folder, these backup entries need to be deleted as well. Please open a support ticket with all the relevant information (your cloud name and folders name) and we'll be glad to help with that. 

    0
  • Hans

    We run a regularly scheduled housekeeping job to delete any resources from our Cloudinary library that are no longer in use in our application but were for one reason or another not deleted at the appropriate time.

    For this we essentially retrieve the full list of resources by prefix, compare their publicIds against those in our application database and then use the bulk deletion API call. We also make heavy use of folders in our library, and in many cases when we delete a resource,we are left with an empty folder or tree of folders.

    I know there is an admin API method to explicitly delete empty folders, but to do so requires yet more IMO unnecessary API queries. Instead, it would be great to have the option, as an optional parameter in the delete resources API call, to automatically delete any empty folders left behind after deleting resources.

    I'd actually submit this as a feature request/suggestion, but the "Submit Feature" link in this Support area doesn't seem to work, and only takes you to the Roadmap screen.

    0
  • soyoungcheng

    Hi

    Its possible delete folder from iOS SDK?
    I have try this code to delete folder... No Error, but result = "Not found" 

    do you any suggestion?
    thanks

    Young

    ----------------------------------------------------------

    let config = CLDConfiguration(cloudName: "NAME", apiKey: "KEY") 
    let result = cloudinary.createManagementApi()
        .destroy("PARENT_FOLDER / WANT_TO_DELETE_FOLDER_NAME", params: CLDDestroyRequestParams())

    result.response { result, error in

        print(result)

    }

    0
  • Thomas Gurung

    Hi Young,

    Thanks for reaching out.

    iOS SDK does not support the deletion of folders currently and although you can delete specific assets via the method you included in your comment - we strongly advise against carrying out any admin tasks or anything that requires your API secret in your iOS app itself.

    And the reason for this is that you'd need to pass the API secret to the configuration which would expose your secret in the client-side code so anyone could retrieve this and compromise your account/assets. 

    I would recommend you set up a backend server using one of our backend SDKs which will secure your API secret. This will not only let you delete folders securely but also provide you access to all the other APIs that require authentication.

    Please let me know if you have any further questions.

    Thanks,
    Thomas

    0

Please sign in to leave a comment.