Below is my code for creating a symlink of a directory:
sudo ln -s /usr/local/nginx/conf/ /etc/nginx
I already created the directory /etc/nginx
. I just want the contents of the source directory (/usr/local/nginx/conf/
) to be in the contents of the target directory (/etc/nginx
). But when I execute the code, /etc/nginx
contains a directory called conf
, instead of the contents of conf
. That directory contains the contents I want, but in the wrong location.
Why did it put a directory in the target folder, instead of just putting the contents of the directory in the target folder?
This is the behavior of ln
if the second arg is a directory. It places a link to the first arg inside it. If you want /etc/nginx
to be the symlink, you should remove that directory first and run that same command.