coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Advanced syntax for cp --parents


From: Fergus
Subject: Advanced syntax for cp --parents
Date: Mon, 23 Jan 2017 15:48:40 -0000

Starting at b3/ I need to copy everything under /b1/b2/b3/b4/b5 to
/{pathname} (i.e. to create /{pathname}/b3/b4/b5 with all descendants).
To achieve this I move from present location to /b1/b2 and then use cp with
the switch --parents:
$ cd    /b1/b2
$ cp    -vr    --parents    b3/b4/b5    /{pathname}
Is there a way I can achieve this without an explicit change directory?
For example: a similar requirement to tar the same subdirectory as above
with all descendants can be achieved through
$ tar -cf archive.tar -C /b1/b2  b3/b4/b5
where the switch -C  DIR indicates a virtual change directory to DIR before
performing any operations. 
i.e. I am seeking similar versatility for cp, to that provided by -C DIR for
tar.
Any ideas?
Thank you!
Fergus




reply via email to

[Prev in Thread] Current Thread [Next in Thread]