How to create softlinks to all files in a directory in a different directory in terminal?

From man ln:

SYNOPSIS

   ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)
   ln [OPTION]... TARGET                  (2nd form)
   ln [OPTION]... TARGET... DIRECTORY     (3rd form)
   ln [OPTION]... -t DIRECTORY TARGET...  (4th form)

DESCRIPTION

In the 1st form, create a link to TARGET with the name LINK_NAME. In the 2nd form, create a link to TARGET in the current directory. In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. Create hard links by default, symbolic links with --symbolic.

Reading it carefully, you'll see that (assuming that the source folder contains more than one file) you used the 3rd form. Since you didn't specify a directory, the last filename is interpreted as directory.

If you are inside the directory you want to create the symlinks in, you can simply add . (current directory) at the end of the command:

ln -fs ./source/* .

I wanted/needed to do something and @danzel gave the best answer. Here's what I needed: create a symbolic within the WordPress’ plugin folder to another folder within the root of the WordPress installation.

  1. navigate to the folder
  2. make sure I am in the right folder
  3. list all the items in the folder
  4. create the symbolic link

Here are the commands:

$ cd wp-content/plugins
$ pwd
$ ls -al
$ ln -s ../../my-folder-with-subfolders/subfolder-name/* .
$ ln -s ../../my-folder-with-subfolders/another-subfolder/* .