Search and remove all public shared links

Dear all,

I am new here so I am sorry if I select the wrong category.
I have a large folder tree that has many folders and files. The folder itself is shared with a group. From time to time, I share public links of some of the files and the folders .
How can I find all shared links I made and remove them all at once without affecting the group sharing.

Best regards!
Ibraheem

You can use share api. ownCloud Documentation Overview
First, list all the shares that you have, after that determine unwanted shares and delete them all programmatically.