Symbolic links in Ubuntu Recursively refer to files in one directory to another

After searching stackoverflow and Google for the last hour, I thought I would ask. If the name doesn't make sense, this is what I want to achieve.

/var/www/xxx/ 

Say there are files in this directory above.

/var/www/yyy/

I want the files found in the xxx directory to be symbolically linked in the yyy directory. I cannot figure out how to make symbolic links work as such:

/var/www/yyy/filefromfolderxxx.html

unlike what I keep getting:

/var/www/yyy/xxx/filefromfolderxxx.html

Any help would be greatly appreciated.

+3
source share
2 answers

Try the following:

cd /var/www/xxx
for a in * ; do ln -s /var/www/xxx/$a /var/www/yyy/$a ; done

This will symbolically link all the files one by one.

, . , , , , . , , , .
+4

ln -s /var/www/xxx/* /var/www/yyy

ln: xxx yyy. .

0

All Articles