PDA

View Full Version : Command-line syntax : a question about cp --parents



fergus
06-13-2011, 11:01 AM
I cannot find (and don't know whether there is) a Forum specific to command-line syntax questions, so I'll post it here. Please put me right if I want to go elsewhere (and I apologise for wasting your time). Here is the question. Thank you!

I can use
cp -vr --parents /a/b/c/d /x/y
to create a directory /x/y/a/b/c/d containing everything at d and everything under d.

But how could I create a directory x/y/b/c/d (ie omitting a)? I could MOVE to /a/ and then use
cp -vr --parents b/c/d /x/y
but I really don't want to do the MOVE (and can think of circumstances where I might not be able to).

I'm really looking for something exactly similar to the
tar -C DIRNAME
switch that allows one to make a virtual move to the directory DIRNAME before commencing the tar operation.

Thank you!

Fergus

PS Again, sorry - if there is a Forum under Knoppix.NET (or for that matter elsewhere) specific to questions about command-line syntax, please point me to it ...

Capricorny
06-27-2011, 11:35 AM
This is not Knoppix-specific at all? What about trying sites like linuxquestions.org?
Tip: Check out rsync whenever you feel you approach the capabilities of cp.