Recursively move this file or directory tree to the given destination.
(self, target)
| 1367 | _copy_info(source.info, self, follow_symlinks=False) |
| 1368 | |
| 1369 | def move(self, target): |
| 1370 | """ |
| 1371 | Recursively move this file or directory tree to the given destination. |
| 1372 | """ |
| 1373 | # Use os.replace() if the target is os.PathLike and on the same FS. |
| 1374 | try: |
| 1375 | target = self.with_segments(target) |
| 1376 | except TypeError: |
| 1377 | pass |
| 1378 | else: |
| 1379 | ensure_different_files(self, target) |
| 1380 | try: |
| 1381 | os.replace(self, target) |
| 1382 | except OSError as err: |
| 1383 | if err.errno != EXDEV: |
| 1384 | raise |
| 1385 | else: |
| 1386 | return target.joinpath() # Empty join to ensure fresh metadata. |
| 1387 | # Fall back to copy+delete. |
| 1388 | target = self.copy(target, follow_symlinks=False, preserve_metadata=True) |
| 1389 | self._delete() |
| 1390 | return target |
| 1391 | |
| 1392 | def move_into(self, target_dir): |
| 1393 | """ |
no test coverage detected