This discussion has some useful observations, and simple scripts to already provide that functionality: