Can I rename a file and force it to overwrite any potentially existing files?

I would like to rename a file and make it overwrite any potential files with the same name. That is, given files A and B, I would like to rename A to B, overwriting B and being left with only file B that has the contents of the previous file A and not the previous file B.

http://stackoverflow.com/questions/12319756/gradle-copy-task-how-to-overwrite-existing-files