yep just use .. like "../../mygrandpa/uncle/cuosin.txt"
Is it possible to create a symlink that uses a relative path instead of an absolute one?
yep just use .. like "../../mygrandpa/uncle/cuosin.txt"
Sweet it works, thanks.
I could have swore I tried that though..oh well
![]()
Annoyingly Panther doesn't have the "readlink" command like Tiger, but "file" can read symlinks though
did you try "ln -l" which makes a "soft" symlink...
If you symlink to an *existing* file, the symlink is changed to an absolute path.
However, if you symlink to a *non*existing file (or, a to file whose pathname contains a symlink), then you get a relative link:
cd
mkdir Tmp1
mkdir Tmp2
touch Tmp1/file1
cd Tmp2
ln -s ../Tmp1/file1 f1
ln -s ../Tmp1/file2 f2
ls -l
# f1 @ -> /Users/yeti/Tmp1/file1
# f2 @ -> ../Tmp1/file2
You can then create Tmp1/file2, and Tmp2/f2 will be a relative link to it.
[Hmm, my characterization isn't *quite* complete, since `cd ; ln -s Tmp1/file1 f1` also creates a relative symlink, even though `Tmp/f1` exists.]
I don't know why `ln` doesn't just have a switch to force an absolute-path, with relative paths being the default.
[This is all confirmed on 10.8 Mountain Lion, but I suspect it's been like this for a while.]
If you symlink to an *existing* file, the symlink is changed to an absolute path.
However, if you symlink to a *non*existing file (or, a to file whose pathname contains a symlink), then you get a relative link:
cd
mkdir Tmp1
mkdir Tmp2
touch Tmp1/file1
cd Tmp2
ln -s ../Tmp1/file1 f1
# linking to a file that doesn't yet exist:
ln -s ../Tmp1/file2 f2
ls -l
# f1 @ -> /Users/yeti/Tmp1/file1
# f2 @ -> ../Tmp1/file2
You can then create Tmp1/file2, and Tmp2/f2 will (still) be a relative link to it.
[Hmm, my characterization isn't *quite* complete, since `cd ; ln -s Tmp1/file1 f1` also creates a relative symlink, even though `Tmp/f1` exists.]
I don't know why `ln` doesn't just have a switch to force an absolute-path, with relative paths being the default.
[This is all confirmed on 10.8 Mountain Lion, but I suspect it's been like this for a while.]
Bookmarks