Rename this path to the target path. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the Path object. Returns the new Path instance pointing to the target path.
(self, target)
| 1262 | self.unlink() |
| 1263 | |
| 1264 | def rename(self, target): |
| 1265 | """ |
| 1266 | Rename this path to the target path. |
| 1267 | |
| 1268 | The target path may be absolute or relative. Relative paths are |
| 1269 | interpreted relative to the current working directory, *not* the |
| 1270 | directory of the Path object. |
| 1271 | |
| 1272 | Returns the new Path instance pointing to the target path. |
| 1273 | """ |
| 1274 | os.rename(self, target) |
| 1275 | if not hasattr(target, 'with_segments'): |
| 1276 | target = self.with_segments(target) |
| 1277 | return target |
| 1278 | |
| 1279 | def replace(self, target): |
| 1280 | """ |