coreutils
[Top][All Lists]
Advanced

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

Re: cp with subdirectories following some pattern removed?


From: Pádraig Brady
Subject: Re: cp with subdirectories following some pattern removed?
Date: Wed, 11 Jul 2012 18:20:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

On 07/11/2012 06:13 PM, Pádraig Brady wrote:
> On 07/11/2012 05:27 PM, Peng Yu wrote:
>> Hi,
>>
>> I need to cp a directories with all the the subdirectories matching a
>> pattern removed (ignore all the test* subdirectories). There can be
>> many solutions to this problem. I'm wondering if anybody is aware of
>> an easy and robust solution. Thanks!
> 
> This sort of thing is surprisingly tricky.
> I've used something like the following in the past:
> 
> (cd dir1 && find -mindepth 1 \( -type d -a -name 'test*' \) -prune -o -print0 
> |
>  tar --null -T- -c) |
> (cd dir2 && tar -x)
> 
> The above can be easily extended by putting ssh in the pipe.

The first tar should have --no-recursion specified also for efficiency

cheers,
Pádraig.



reply via email to

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