how to copy dir by excluding some subdir?
Rick Stevens
rstevens at vitalstream.com
Thu Oct 19 23:14:31 UTC 2006
On Thu, 2006-10-19 at 18:27 -0400, yonas Abraham wrote:
> i want to copy one directory with big sub directory and files on it
> with the exception of some of its sub directories.
>
> I usually just do cp -r A B, and go to B and delete the once that I
> don't need it. But this becomes expensive as the size of the subdir
> gets bigger and bigger.
>
> I was hopping something like cp -r --exclude=C A B, to copy dir A to B
> with the exception of dir C which is a sub dir of A. But man cp,
> didn't give me such thing.
You might try using rsync as it does support an "exclude" option:
rsync -av --exclude=A/C A/ B
See "man rsync" for details and pay attention to the FILTER section.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer rstevens at vitalstream.com -
- VitalStream, Inc. http://www.vitalstream.com -
- -
- The light at the end of the tunnel is really an oncoming train. -
----------------------------------------------------------------------
More information about the users
mailing list