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)
| 1064 | self.unlink() |
| 1065 | |
| 1066 | def rename(self, target): |
| 1067 | """ |
| 1068 | Rename this path to the target path. |
| 1069 | |
| 1070 | The target path may be absolute or relative. Relative paths are |
| 1071 | interpreted relative to the current working directory, *not* the |
| 1072 | directory of the Path object. |
| 1073 | |
| 1074 | Returns the new Path instance pointing to the target path. |
| 1075 | """ |
| 1076 | os.rename(self, target) |
| 1077 | if not hasattr(target, 'with_segments'): |
| 1078 | target = self.with_segments(target) |
| 1079 | return target |
| 1080 | |
| 1081 | def replace(self, target): |
| 1082 | """ |