Let’s say (hypothetically) that I wanted to make a symlink to my Documents folder on my Desktop. I would do this:
cd ~/Desktop
ln -s ~/Documents
which will make a symlink called Documents on my Desktop.
However, when I do this (note the trailing slash after ~/Documents:
cd ~/Desktop
ln -s ~/Documents/
I get:
ln: ./: File exists
Howcome? Why does the trailing slash matter in this case, and what does a trailing slash mean in general?
As noted in the comments, the trailing slash is application-dependent. On my system (CentOS 5), both worked fine.
In this case, I’d say that ln is interpreting
~/Documents/as a path, and using a default filename of.to refer to the current directory, for an effective combined path of~/Documents/.. Since you’re not specifying the name of the destination link, it’s picking the one that matches the ‘sepecified’ filename,., which already exists.I get a similar error to yours when I specify
~/Documents/.explicitly.You can solve this by specifying the name of the link to create explicitly.
ln -s ~/Documents/ Documentsshould work for you.