How do I delete an empty folder using the Destroy method of the Upload Api?
I am able to remove the images in a folder, but when a folder PublicId (path) is sent with the Destroy method "Not Found" is returned. This leaves phantom folders in the cloudinary media library.
-
We have an API method for deleting empty folders, but it is not currently documented or supported in our SDKs. It is on our roadmap to support this. While no ETA for it yet, I'll gladly let you know once it's ready.
However, you can accomplish this by calling the API directly, for example:
curl -X DELETE -u <API_KEY>:<API_SECRET> "https://api.cloudinary.com/v1_1/<cloud_name>/folders/<folder>"0 -
What is the status of this presently? Being able to delete folders (both with children and empty) should be possible via the SDKs directly.
0 -
Hi Isaac, deleting empty and not empty folders is on our roadmap. but no ETA yet.
0 -
Hello, Shirly.
I have try to use described API call from node.js, but received 'allow-control-allow-origin' error.
Auth was specified.
Thanks0 -
Hi Ivan,
Can you please open a ticket at support@cloudinary.com with more information on your implementation so that we can further assist you?
0 -
Update:
You can now delete a folder with assets via Media Library UI.
0 -
What is the status of this ticket now after 5 years? I also need to delete a folder via API using the destroy method
0 -
Hi Ganizani,
Thank you for reaching out.
So to delete folders you need to use the delete_folder API, more details on this can be found via https://support.cloudinary.com/hc/en-us/articles/202520972-How-can-I-delete-a-folder-from-the-Media-Library-
Please let me know if you have any other questions or queries.
Kind Regards,
Thomas0
Post is closed for comments.
Comments
8 comments