API to delete the documents inside a folder

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.


Hi @JeevanaTeja ,

what you are looking for is a custom folder context menu item.
There is documentation available here on how to achieve that.
There is also an open source plugin that does something similar for copy/move here. You can use it as an example for your case.

Kind regards

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.


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.

1 Like