I have some bitcoins in an old bitcoin-core wallet and would like to transfer all of them to a new BIP32 wallet. I tried doing sendtoaddress with subtractfeefromamount=true, but bitcoin transferred all but 0.0005BTC to the new address (I suspect some rounding issue when calculating the fee and amount to send). So now I have an address with 0.0005BTC (plus some other addresses with a larger amount). How can I reliably transfer all funds so that all the addresses in the old wallet have zero balance?
Furthermore, is there a way to verify that all addresses for which I have the private key have a zero balance?