Note that if basePath is on a different filing system (or drive, in Windows, I guess) then the rename operation may fail. We could try a copy if the rename fails. We could read and write the bits to the basePath (or basePath+"~" or similar)