Cannot create symbolic link inside different folder
Solution 1:
You must use the full path for both the source and target.
ln -sF /Users/allan/Desktop/Explore /Users/allan/Desktop/folder/testExplore
Hint:
An easy way to expand out your path (if you are in it already) is to expand the variable PWD
(use $PWD
to reference it)
ln -sF $PWD/Explore $PWD/folder/testExplore
And if you hit the Tab key after referencing the PWD variable:
ln -sF $PWD
Tab gives you:
ln -SF /Users/allan/Desktop/
Solution 2:
You can use relative paths but you need to be in the folder you are creating the link
e.g.
cd folder
ln -sF "../Explore" "testExplore"
The thing to realise is how is the link expanded. In your case the testExplore has no idea what the path to Explore is it just replaces testExplore by Explore and looks for the file/directory Explore in the directory folder.
In my example the testExplore gets replaced by ../Explore so getting to the original file.
In a symbolic link the original link is replaced by the text that it was linked to and then that full path is used