PyDocs

Nav

File and Directory Access

Path.symlink_to

pathlib

method of Path (source)
  • Path.symlink_to(target, target_is_directory=False)
Make this path a symlink pointing to the target path.
Note the order of arguments (link, target) is the reverse of os.symlink.
Changed in 3.13
  • 3.13: Raises UnsupportedOperation if os.symlink() is not available. In previous versions, NotImplementedError was raised.
1 Example
>>> p = Path('mylink')
>>> p.symlink_to('setup.py')
>>> p.resolve()
PosixPath('/home/antoine/pathlib/setup.py')
>>> p.stat().st_size
956
>>> p.lstat().st_size
8
from the Python docs
See Also
No see-alsos for pathlib/Path.symlink_to
0 Notes
No notes for Path.symlink_to