API Deletion Of Folder
I can create folders automatically during upload and delete the contents via the Admin API. However I can't seem to find a way of deleting empty folders via code. It appears that I have to manually go in and remove them via the UI. Is there a way of doing this?
-
Hi Dessie,
We have an API method for deleting folders, but it is not currently documented or supported in our SDKs. It is on our roadmap to support this, but there is currently no ETA.
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>"
-
That doesn't seem to work fine.
For empty folders that were containing already deleted files (so only available as backup). This method returns a 'folder is not empty' message while it is logically empty.
Files have been deleted by the API (not by the console).
@Yakir, any workaround on this?
-
Hi Johny,
You can delete empty folders using the API method Yakir mentioned, which is supported now in many of our SDKs or can be called directly via an HTTP request.
For non-empty folders you need to delete the files inside first, and if a folder is empty except for backup copies of deleted files, it can be deleted in our Media Library UIRegards,
Stephen
Please sign in to leave a comment.
Comments
5 comments