Recursively move this file or directory tree to the given destination.
(self, target)
| 1169 | copy_info(source.info, self, follow_symlinks=False) |
| 1170 | |
| 1171 | def move(self, target): |
| 1172 | """ |
| 1173 | Recursively move this file or directory tree to the given destination. |
| 1174 | """ |
| 1175 | # Use os.replace() if the target is os.PathLike and on the same FS. |
| 1176 | try: |
| 1177 | target = self.with_segments(target) |
| 1178 | except TypeError: |
| 1179 | pass |
| 1180 | else: |
| 1181 | ensure_different_files(self, target) |
| 1182 | try: |
| 1183 | os.replace(self, target) |
| 1184 | except OSError as err: |
| 1185 | if err.errno != EXDEV: |
| 1186 | raise |
| 1187 | else: |
| 1188 | return target.joinpath() # Empty join to ensure fresh metadata. |
| 1189 | # Fall back to copy+delete. |
| 1190 | target = self.copy(target, follow_symlinks=False, preserve_metadata=True) |
| 1191 | self._delete() |
| 1192 | return target |
| 1193 | |
| 1194 | def move_into(self, target_dir): |
| 1195 | """ |
no test coverage detected