use atomicity of makedir() to prevent race conditions in copydir(overwrite=False) and movedir(overwrite=False)