user2175783
user2175783

Reputation: 1441

sym link parent dirs

ln basic question from a beginner:

I have some legacy code that looks for a series of files at a location

/a/b/c/d/e/f/g/h/i/

for example

/a/b/c/d/e/f/g/h/i/abc.xml

the files are really at a location

/z/w/v/d/e/f/g/h/i/

I tried to link /z/w/v to /a/b/c like

mkdir /a/b/c
ln -s /z/w/v /a/b/c

but when I cd /a/b/c I end up one level higher. Is it possible to ln the parent dirs like this or I just have to link the files?

Upvotes: 0

Views: 21

Answers (1)

Barmar
Barmar

Reputation: 781721

The problem is that the directory /a/b/c already exists, because of the mkdir. So when you make the link, it thinks you want to make a link in the c, not from c itself. So it's as if you did:

ln -s /z/w/v /a/b/c/v

Do it like this:

mkdir /a/b
ln -s /z/w/v /a/b/c

Upvotes: 1

Related Questions