Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Appending files to a cpio archive with gzip
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
brumik  
View profile  
 More options Nov 5 2012, 2:50 am
Newsgroups: comp.unix.shell
From: brumik <brum...@gmail.com>
Date: Sun, 4 Nov 2012 23:50:47 -0800 (PST)
Local: Mon, Nov 5 2012 2:50 am
Subject: Re: Appending files to a cpio archive with gzip
On Nov 5, 4:20 am, Barry Margolin <bar...@alum.mit.edu> wrote:

> In article <k76io1$v7...@news.xmission.com>,
>  gaze...@shell.xmission.com (Kenny McCormack) wrote:

> > In article <barmar-18FAF5.15094004112...@news.eternal-september.org>,
> > Barry Margolin  <bar...@alum.mit.edu> wrote:
> > ...
> > >You can't append to an existing compressed file.  You have to decompress
> > >it, add to that, and then recompress.

> > Oopsie!

> > From "man gzip":

> > ADVANCED USAGE
> >        Multiple  compressed  files  can  be concatenated. In this case, gunzip
> >        will extract all members at once. For example:

> >              gzip -c file1  > foo.gz
> >              gzip -c file2 >> foo.gz

> >        Then

> >              gunzip -c foo

> >        is equivalent to

> >              cat file1 file2

> > Whether this works with tar and/or cpio (or any other archiving format) is,
> > of course, a function of the particular archiver format chosen.

> > >The fact that it contains a cpio archive is irrelevant -- this is just
> > >the nature of the gzip file format.

> > Actually, as you now see, it does matter.

> Oops, sorry.

> So the question then is whether you can append one cpio archive onto
> another.  Because your original attempt is effectively equivalent to:

> ( find test | cpio -o; find test1 | cpio ) | gzip -c

> --
> Barry Margolin, bar...@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***

I tried this but still cant get it to work, by example I want to
archive all files in dir1, but only directories in dir2 to the
archive:

# find . | sort
.
./dir1
./dir1/testfile
./dir2
./dir2/dir_to_backup
./dir2/dont_backup_file

# ( find dir1 | cpio -ov; find dir2 -type d | cpio -ov ) | gzip -c > /
var/tmp/testarchive.cpio.gz
dir1
dir1/testfile
1 blocks
dir2
dir2/dir_to_backup
1 blocks

# gzip -dc /var/tmp/testarchive.cpio.gz | cpio -it
dir1
dir1/testfile
1 blocks

As we see only dir1 was archived, unfortunately despite many tries I
cant find a way to use the find command (solaris) to find all given
files in a directory but *only* print directory names under dir2 (in
one command), hence was using two find commands,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.