# API to delete the documents inside a folder

**URL:** <https://community.bloomreach.com/t/api-to-delete-the-documents-inside-a-folder/3675>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [February 21, 2023, 10:53am UTC](https://community.bloomreach.com/t/api-to-delete-the-documents-inside-a-folder/3675 "2023-02-21T10:53:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeevanaTeja](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jeevanateja/32/1487_2.png) [@JeevanaTeja](https://community.bloomreach.com/u/JeevanaTeja)\
**Post date:** [February 21, 2023, 10:53am UTC](https://community.bloomreach.com/t/api-to-delete-the-documents-inside-a-folder/3675/1 "2023-02-21T10:53:32Z")

</div>

Hi All,

I am looking for an API or any shortcut way to delete all items inside the folder without deleting the folder.  
Can someone help me with this.

Thanks,  
Jeevana

---

<div class="post-metadata">

**Author:** ![Lef\_Karamoulas](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/lef_karamoulas/32/82_2.png) [@Lef\_Karamoulas](https://community.bloomreach.com/u/Lef_Karamoulas)\
**Post date:** [February 21, 2023, 11:12am UTC](https://community.bloomreach.com/t/api-to-delete-the-documents-inside-a-folder/3675/2 "2023-02-21T11:12:33Z")

</div>

Hi @JeevanaTeja ,

what you are looking for is a custom folder context menu item.  
There is documentation available [here](https://xmdocumentation.bloomreach.com/library/concepts/plugins/menu-plugin.html#scroll_folder-context-menu) on how to achieve that.  
There is also an open source plugin that does something similar for copy/move [here](https://bloomreach-forge.github.io/folder-context-menus/). You can use it as an example for your case.

Kind regards

---

<div class="post-metadata">

**Author:** ![JeevanaTeja](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jeevanateja/32/1487_2.png) [@JeevanaTeja](https://community.bloomreach.com/u/JeevanaTeja)\
**Post date:** [February 23, 2023, 12:38pm UTC](https://community.bloomreach.com/t/api-to-delete-the-documents-inside-a-folder/3675/3 "2023-02-23T12:38:32Z")

</div>

Thanks for the reply.  
Actually, I am not looking for custom folder.

I have an API which supports individual document deletion. If I want to delete all the documents from a folder & exclude the folder from deletion. How can I achieve this.

suppose there is folder named “home” with multiple files inside the home folder.  
now I have given the path till content/home/ in my postman to delete those multiple files, as a result it is deleting the home folder as well. it should exclude the folder.

Thanks,  
Jeevana

---

<div class="post-metadata">

**Author:** ![jasper.floor](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/jasper.floor/32/28_2.png) [@jasper.floor](https://community.bloomreach.com/u/jasper.floor)\
**Post date:** [February 23, 2023, 12:53pm UTC](https://community.bloomreach.com/t/api-to-delete-the-documents-inside-a-folder/3675/4 "2023-02-23T12:53:37Z")

</div>

If you have the path to the folder, you have the jcr node. You can ask the node for all it’s children. Iterate and delete each child node.
