Skip to main content

how can I delete empty folder?



  • Shirly Manor

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

    If you have further questions, please feel free opening a support ticket:

  • 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' ));
  • 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> "<cloud_name>/folders/<folder>"

  • Reginald Johnson

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

  • 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> "<CLOUD_NAME>/folders/<FOLDER>"
  • Mohamad El-Husseini

    Hi Shirly,


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



  • 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:
    You can add the prefix as the folder name and also choose if you would like to delete the derivatives as well.


Post is closed for comments.