0

I have a folder of files folderA/ and an empty folder folderB/

folderA/
    file1
    file2
    file3
    ...

folderB/

How can I create a symlink in folderB/ to each file in folderA/ without linking each individually? There are lots of files. Using bash, Ubuntu 20.04.

I tried the answer given here: https://superuser.com/a/429508 and here: https://stackoverflow.com/a/1347142/6673905, but it did not work.

From folderA/, I ran

ln -s * /path/to/folderB/

It created symlink cycles in folderB/:

folderB/
    file1 -> file1
    file2 -> file2
    file3 -> file3
    ...

where the symlinks link to themselves, not to files in folderA/.

JonahHuron
  • 395
  • 1
  • 4
  • 10

1 Answers1

0
ln -s * /path/to/folderB/

Is equivalent to use:

ln -s file1 file2 file3 /path/to/folderB/

In my experience, ln -s is very picky about the paths.

You can try:

ln -s $PWD/* /path/to/folderB/