Skip to main content

how can I delete empty folder?

Comments

7 comments

  • Shirly Manor

    Here is more information of how to delete an empty folder:

    https://support.cloudinary.com/hc/en-us/articles/202520972-How-can-I-delete-an-empty-folder-from-the-Media-Library-

    If you have further questions, please feel free opening a support ticket:
    http://support.cloudinary.com/tickets/new

    -1
  • Tim Robidoux

    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
  • Shirly Manor

    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
  • Reginald Johnson

    Shirly, is this still valid?  Has there been any work on adding this functionality to any SDKs?

    0
  • Shirly Manor

    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
  • Mohamad El-Husseini

    Hi Shirly,

     

    Does deleting a folder using this endpoint also delete its contents?

     

    Thanks!

    0
  • Raya Straus

    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.