views:

43

answers:

2

I want a folder /public_html to symlink to /current/app/webroot, both are in the same directory

I have tried

ln -s public_html current/app/webroot

amongst other things, but no joy so far. Any ideas?

A: 

If you want public_html to be a symlink to somewhere else, you need to write the "somewhere else" first and the target second:

ln -s `pwd`/current/app/webroot public_html

Also, if you already have a normal public_html directory, you need to remove that first.

(Also, what Clippy said above.)

Kilian Foth
As the order of ln's arguments confuse a lot of people: It's the same order you use with cp - first the thing you have, than the thing you want.
Florian Diesch
+1  A: 

You needed to check ln man

   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)

First target, then link name

In case of

/some/directory/
  current/
    app/
      webroot/
  public_html -> current/app/webroot

you need to do this

`ln -s current/app/webroot public_html`

It's not mandatory for ln to give absolute paths, relative ones work too

Dmitry Yudakov
great, thank you got that working
@user343223: You should select Dmitry's answer if you're happy with it.
Charles Stewart