- # Check for overwrite permission on existent files
- if os.path.exists(dest) and not os.access(dest, os.W_OK):
- raise cant_overwrite_exc
+ # Don't overwrite unless forced to
+ if os.path.exists(dest):
+ if not overwrite:
+ raise file_exists_exc;
+ else:
+ if not os.access(dest, os.W_OK):
+ raise cant_overwrite_exc