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: Jim Meyering
Subject: Re: cp with subdirectories following some pattern removed?
Date: Thu, 12 Jul 2012 09:37:12 +0200

Pádraig Brady wrote:
> On 07/11/2012 07:44 PM, Jim Meyering wrote:
>> Peng Yu wrote:
>>> 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!
>>
>> I would use rsync for that:
>>
>>     rsync -avP --exclude='test*' A B
>
> Nice one.
> I learned today that rsync prunes whole branches based on the above.
> I also notice rsync supports sophisticated --filter rules
> which are not needed for simple filtering like this.

Yes, between the usable --include/exclude{-from} options and the
more general/complete --filter, there's nothing rsync can't do ;-)

> Note however that the 'test*' above should end in '/'
> so as to apply to just directories and leave any test*
> files (not under a test* dir) in the copy.

Good point.  Thanks.



reply via email to

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