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

Re: Copy all except one



Michael Wördehoff wrote:
> 
> Hello Russel,
> if you're still fiddling, you may check out the following. You'll need no
> mkdir this way.
> 
> # Copy Directory-Tree beginning from $SOURCE, with
> # Subdirs and single files, excluding Directory $EXDIR:
> 
> find $SOURCE -path $EXDIR -prune -or -print | cpio -pdv $TARGET
> 
> # < -print > will only be evaluated, if the < -prune > expression ist not
> true.
> 
> # Two different EXDIRs:
> find $SOURCE -path $EXDIR1 -prune -or -path $EXDIR2 -prune -or -print | cpio
> -pdv $TARGET
> 
> And so on. SOURCE=/bin and TARGET=/mnt should create a /mnt/bin directory.

I didn't realize 'find' had so many useful parameters. I made a
script that copies the whole system onto another drive (ignoring
the contents of a few directories such /dev and /proc). I can post
it if anyone's interested, but i'd probably do it differently with
the find command if i did it again.



Reply to: