How to create a relative symbolic link that would always point to original folder two levels up? I would like to create a computer-independent alias that would work on any machine, provided that the original folder exists two levels up.
Basically, what I want is this:
|-- Original |-- folder 1 |-- folder 2 |-- Original alias
I need this for my XCode project structure. I've tried:
ln -s Original /../../Original
but it creates an alias that cannot find its original folder.
Find the file or folder you want to create a symlink for, right-click on it, and select Services followed by Make Symbolic Link. It'll create the symlink in the same folder as the original file/folder. You can move it around though if you want.
As the most common shells expands paths, to create a relative symlink you should quote the "source path". Also, the -s parameter means --symbolic . ln creates hard links by default.
Symbolic link can be of two types Relative or Absolute.
Open Finder on your Mac. From the Mac menu bar, select “View” Choose “Show Path Bar” (This surfaces the path for any file selected at the bottom of the Finder window.
I think, you have the order of the arguments backwards. It should be:
$ ln -s <dest> <link>
Where <dest>
becomes the contents of the new link created.
In your specific example:
$ cd "folder 1"/"folder 2" $ ln -s ../../Original Original
Or, in one command, from base directory:
$ ln -s Original "folder 1/folder 2/Original"
take out the first /
- thats an absolute link from root, you want ../../
to be relative from current location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With