Spinup is the hardest thing, and most power consuming thing the harddrive's motor has to do. Depending on how often it would spin down and spin up, the power savings may be very little. This is because it takes a lot more power to get it spinning than it does to maintain it. Also, since it is heating up and cooling down more, the parts will expand and contract, eventually making them fragile.
This is only a good idea if the harddrives will go unused overnight, or long periods of time like that.
If you are looking for the code to do it, you might want to look in the programming forum, or find somewhere more specialized.
An alternative would be to get external enclosures. That way you can just power them off yourself.