how can I delete empty folder?
Hello,
I am using delete_all_resources request and it deletes all images from folder I want, but not the folder. How can I delete folder too?
-
Here is more information of how to delete an empty folder:
If you have further questions, please feel free opening a support ticket:
http://support.cloudinary.com/tickets/new-1 -
Apologies, I meant delete empty folder using API. I'm deleting all resources from folder and I would like to delete the folder too.
I'm using this right now:
$api->delete_all_resources(array( 'folder' => 'folder_name' ));
1 -
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 -
Shirly, is this still valid? Has there been any work on adding this functionality to any SDKs?
0 -
Yes, Unfortunately, there is no ETA to add it to our SDK yet. The way to delete a folder is by using the following code:
curl -X DELETE -u <API_KEY>:<API_SECRET> "https://api.cloudinary.com/v1_1/<CLOUD_NAME>/folders/<FOLDER>"
0 -
Hi Shirly,
Does deleting a folder using this endpoint also delete its contents?
Thanks!
0 -
Hi Mohamad,
The resources will first need to be deleted.
This can be done using the delete_resources_by_prefix method is restricted to 1000 images per call. You can use the list by resource methods to list the resources under the folder and then delete by public id.
Another option would be to use the bulk delete UI in the media library settings: https://cloudinary.com/console/settings/bulk_delete/new
You can add the prefix as the folder name and also choose if you would like to delete the derivatives as well.0
Post is closed for comments.
Comments
7 comments