I want to create a symbolic link (A) to another symbolic link (B) which point to an actual file (C) on macOS with python >= 3.10:
A -> B -> C
I tried this:
from pathlib import Path
A = Path('/path/to/src')
B = '/path/to/another/symlink'
A.symlink_to(B)
print(A.resolve()) # prints C, not B
But it didn't work.
How do I do this with python?
CodePudding user response:
Use A.readlink()
instead of A.resolve()
.