Skip to content

Instantly share code, notes, and snippets.

@willprice
Created August 5, 2020 13:47
Show Gist options
  • Select an option

  • Save willprice/311faace6fb4f514376fa405d2220615 to your computer and use it in GitHub Desktop.

Select an option

Save willprice/311faace6fb4f514376fa405d2220615 to your computer and use it in GitHub Desktop.
Create relative symlinks in python
@Sispheor
Copy link

Sispheor commented Mar 7, 2023

Works like a charm. Thank you 🙂

@milahu
Copy link

milahu commented Aug 2, 2025

see also Creating a relative symlink in python without using os.chdir()

ideally this should be possible with pathlib.Path.symlink_to like

Path(target).absolute().symlink_to(
  Path(destination).absolute(),
  target_is_directory=Path(target).isdir(),
  relative_symlink=True,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment