Something like
Code:
for d in /mnt/us/*.sdr; do
book = $(basename d .sdr)
if [[ ! -f /mnt/us/${book}.azw* -o ! -f /mnt/us/${book}.mobi ]]; then
rm -r $d
fi
done
There is already a KUAL extension that removes the EndActions, which I extended to rm Personal\ Letter* as well, and this would be fairly easy to do as well... It does of course run on the Kindle itself, but it could just as easily be implemented on the computer, with the heuristic KindleDrive sensing I assume you already do, in any programming language, with the greatest ease.
But this shouldn't be done automatically... the leftovers can be helpful if you re-sideload the book, since sideloaded books do not store annotations on Amazon's servers. That is why sideloaded books specifically leave those remains behind, just in case.
They aren't all that bothersome, considering that the combined filesize is negligible and it doesn't show up in the framework -- unlike the Personal Letters.