[SlugBug] directory copy

Jim Jackson jj at comp.leeds.ac.uk
Thu Jul 24 17:20:19 BST 2003


On Thu, 24 Jul 2003, Bill Best wrote:

> hi
>
> possibly a lame-ish question but needs must and all that...
>
> i'd like to recursively copy a directory's contents to a new location
> but excluding one particularly large sub-directory e.g.
>
> /home/directory1
> /home/directory1/subdirA
> /home/directory1/subdirB
> /home/directory1/subdirC
> /home/directory1/subdirD
>
> /home/directory2
>
> i'd like to copy /home/directory1 to /home/directory2 but omitting
> /home/directory2/subdirC, for example.
>
> perhaps i could do this:
>
> tar cvf directory1 --exclude subdirC | tar -xvf /home/directory2

try....

( cd directory1 ; tar cf - . --exclude subdirC ) | \
  ( cd directory2 ; tar xvf - )

I'm not sure where the --exclude goes, it might have to go before the
current directory '.' , and you might like to try  --exclude ./subdirC
I'm not sure.



>
> but my tests so far haven't worked.
>
> bill
>
> _______________________________________________
> SlugBug mailing list
> SlugBug at email-lists.org
> http://www.email-lists.org/mailman/listinfo/slugbug
>




More information about the SlugBug mailing list