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

Re: split archives using tar



You would need to handle this using the -prune option to find. I just
wrote a script to do something like what you are talking about, and I
*think* that it looks like this:

  cd /home/howard
  find . -path .netscape/cache/* -prune -path vmware/* -prune -o -print \
    | cpio -ovH crc > /mnt/zip/homebackup-`date '+%d-%B-%Y'`.cpio

I will have to look at my scripts again to confirm the syntax exactly,
but the above is generally correct I think. I think there is an option to
find to let you avoid the 'cd' command as I have shown above, but I can't
remember it right at the moment. The info pages for GNU find are
excellent rainy day reading and using this command well is an art in
itself. The find command shown above says:

  find all filepaths starting in the current directory
  if the path is like .netscape/cache/* then discard it from the list
  if the path is like vmware/* then discard it from the list
  or (-o) else include (-print) the filepath

Unlike tar, cpio relies entirely on something else to generate the list
of files for archiving. The list can come from anywhere but is very
frequently generated by a find command. You can also have the list read
from a file or use some other favorite utility to generate it. This makes
cpio backups a litle more hassle to set up in the beginning for simple
cases, but I think in the long run using find is much more flexible.

--- Howard Mann <howardm@xmission.com> wrote:
> What command would one use to _exclude_ certain directories from the
> archive?
> 
> Specifically, what would the cpio command be to achieve the following
> ? :
> 
> 
> tar -cvpf /mnt/zip/homebackup-`date '+%d-%B-%Y'`.tar \
> --directory /home/howard --exclude=vmware --exclude=.netscape/cache . 
> 
> 
> Here I have archived my home directory except for the "vmware" and
> ".netscape/cache" directories.
> 

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://messenger.yahoo.com


Reply to: