Doing ln -fs ./source/* at the destination directory doesn't work
It shows:
./source/file1 is not a directory 2 Answers
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/* . 2 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.
- navigate to the folder
- make sure I am in the right folder
- list all the items in the folder
- 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/* .