Cleanup items

Does someone know whether it is possible (via Karaf or other means) to remove all items that are not being linked via PaperUI or via an .item file.
My installation has been migrating since version 1.5 and I’d like to cleanup all unused stuff without breaking what works.