Why is my symbolic link creating a file and not a folder?

Not creating a directory is an expected behavior.

When you do

  ls -ali

It should show something beginning with;

  lrwxrwxrwx

In which "l" represents symlink and allows you to traverse using cd.

NOTICE: ln command will not complain when you provide an invalid source path. And this will result with an error message when you try cd in to that.


You need to use absolute path names to create the links. For example, I'm now at

$ pwd
/home/alex/my_folder

And I'm creating a symbolic link to the folder "directoryA" in a sub-directory under my pwd (present working directory):

 $ ln -s $PWD/directoryA $PWD/temp/link_to_directoryA

In this case variable $PWD holds absolute path to my working directory. You can surely use your absolute path without any variables like this:

 $ ln -s /home/alex/my_folder/directoryA /home/alex/my_folder/temp/link_to_directoryA

Late for the party.. This is what worked for me..

if you want to create a symbolic link from sourceFolder to destinationFolder you should be inside the parent of the destinationFolder "parentOfDestinationFolder" while doing so.


You need to be inside the same directory where you create the symbolic link

For instance:

cd /Users/me
ln -s somefolder somefolderNewName