How to do "cp -sR" without "can make relative symbolic links..." errors

  • Follow


I want to copy a directory tree but the target tree should consist
only of symlinks to the source tree (with the exception of
directories).

It's basically to create a new instance of a PHP application.

It seems to me that "cp -sR <sourcedir> <targetdir>" should work but
in practive I get loads of "can make relative symbolic links only in
current directory" errors.

So it seems the -s switch doesn't really work with the -R switch.

Is there any way to get around this limitation?

-------------------------------------

HOLD ON! Just found out I can make it work if I type the _full_ path
name for the source directory. i.e. "cp -sR </full/path/to/sourcedir>
targetdir

Just posting this in case anyone else ever gets stuck on this like I
just did. I couldn't find any other post on this in Google.
0
Reply fredphase (11) 8/23/2004 10:51:18 AM

Fred Phase wrote:

> I want to copy a directory tree but the target tree should consist
> only of symlinks to the source tree (with the exception of
> directories).
> 
> It's basically to create a new instance of a PHP application.
> 
> It seems to me that "cp -sR <sourcedir> <targetdir>" should work but
> in practive I get loads of "can make relative symbolic links only in
> current directory" errors.

The error message tells you what the problem is. To make these symlinks, you
have to provide complete paths as arguments.

> So it seems the -s switch doesn't really work with the -R switch.
> 
> Is there any way to get around this limitation?

See above.

> 
> -------------------------------------
> 
> HOLD ON! Just found out I can make it work if I type the _full_ path
> name for the source directory.

Hoo-boy. You sure you couldn't have taken the time to rewrite your post?

-- 
Paul Lutus
http://www.arachnoid.com

0
Reply nospam248 (2243) 8/23/2004 5:12:59 PM


Fred Phase wrote:

> I want to copy a directory tree but the target tree should consist
> only of symlinks to the source tree (with the exception of
> directories).
> 
> It's basically to create a new instance of a PHP application.
> 
> It seems to me that "cp -sR <sourcedir> <targetdir>" should work but
> in practive I get loads of "can make relative symbolic links only in
> current directory" errors.
> 
> So it seems the -s switch doesn't really work with the -R switch.
> 
> Is there any way to get around this limitation?
> 
> -------------------------------------
> 
> HOLD ON! Just found out I can make it work if I type the _full_ path
> name for the source directory. i.e. "cp -sR </full/path/to/sourcedir>
> targetdir
> 
> Just posting this in case anyone else ever gets stuck on this like I
> just did. I couldn't find any other post on this in Google.

There's also a tool 'lndir' from X build which often makes an appearance in
its own right (if it doesn't exist it's likely be trivial to install). It's
exactly what you want for forcing a build outside the source tree for code
that insists on compiling only within its source tree.


0
Reply swamp-DEL-dog (19) 8/23/2004 8:00:58 PM

Fred> I want to copy a directory tree but the target tree should consist
Fred> only of symlinks to the source tree (with the exception of
Fred> directories).

The automake package contains a script called symlink-tree that does
just what you want.

-- 
"It's not true or not."  A reality show producer (real quote)
0
Reply itz (27) 8/24/2004 3:18:46 PM

3 Replies
38 Views

(page loaded in 0.094 seconds)

Similiar Articles:





7/17/2012 10:33:42 PM


Reply: