Skip to content

Commit e59e514

Browse files
authored
Merge pull request #547 from espdev/issue544-invalid-cross-device-link
Fix invalid cross-device link when moving files for local fs
2 parents 6ee47aa + fca45e8 commit e59e514

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fsspec/implementations/local.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def put_file(self, path1, path2, **kwargs):
102102
def mv_file(self, path1, path2, **kwargs):
103103
path1 = self._strip_protocol(path1).rstrip("/")
104104
path2 = self._strip_protocol(path2).rstrip("/")
105-
os.rename(path1, path2)
105+
shutil.move(path1, path2)
106106

107107
def rm(self, path, recursive=False, maxdepth=None):
108108
path = self._strip_protocol(path).rstrip("/")
@@ -244,7 +244,7 @@ def __getstate__(self):
244244
def commit(self):
245245
if self.autocommit:
246246
raise RuntimeError("Can only commit if not already set to autocommit")
247-
os.replace(self.temp, self.path)
247+
shutil.move(self.temp, self.path)
248248

249249
def discard(self):
250250
if self.autocommit:

0 commit comments

Comments
 (0)