Question

After searching stackoverflow and Google for the past hour I thought I would ask. If the title does not make sense here is what I am looking to achieve.

/var/www/xxx/ 

Say there are files in this above directory.

/var/www/yyy/

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

/var/www/yyy/filefromfolderxxx.html

as opposed to what I keep getting:

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

Any help would be greatly appreciated.

Was it helpful?

Solution

Try this:

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

This will symlink all the files one-by-one.

It's a bit messy, though. If you have multiple sites sitting on the same codebase but requiring different configuration files, you should really teach your framework how co-ordinate that for you. It's not really difficult, but does require more thinking than I can spare for this reply, I'm sorry.

OTHER TIPS

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

This tells ln: create a symlink for each file in xxx in the folder yyy. No need for for loops.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top