Cleaning up orphaned image files

I think that I have a lot of image files in my datastores that are orphaned and no longer configured in the opennebula database.

Is there an easy way to verify which files are orphaned? I did it the not easy way but I"m worried about mistakes I might have made, or not understanding dependencies between images.

Here is my not-easy way, does anyone see anything wrong with this? I for a list of files in use. And compared it against the files in my Images datastore.

for i in $(oneimage list -l ID|tail -n +2); do oneimage show $i |grep -e SOURCE ; done