Skip to content

Commit

Permalink
fix deletion when moving file on itself
Browse files Browse the repository at this point in the history
  • Loading branch information
tfeldmann committed Jul 8, 2022
1 parent 17575ba commit bdfc774
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/move.py
Expand Up @@ -64,6 +64,9 @@ def move_file(
with manage_fs(src_fs, writeable=True) as _src_fs:
with manage_fs(dst_fs, writeable=True, create=True) as _dst_fs:
if _src_fs is _dst_fs:
if src_path == dst_path:
return

# Same filesystem, may be optimized
_src_fs.move(
src_path, dst_path, overwrite=True, preserve_time=preserve_time
Expand Down

0 comments on commit bdfc774

Please sign in to comment.