I want to compress a some files in a directory and move them to one
file. It is for a database and the compression type is zip. so now what
I don’t know is how to zip more than one file. what is the seperator of
a file in zip? as I can input more a stream of a file (string) it is
easy to zip one file but several? I found a way but that is by bypassing
the command to the console and execute tar. this is not a nice way and I
want to avoid it if possible.
if somebody already had this problem and knows an answer or just has a
creative idea I would be very pleased to know it.
thanks
andy
I want to compress a some files in a directory and move them to one
file. It is for a database and the compression type is zip. so now what
I don’t know is how to zip more than one file. what is the seperator of
a file in zip?
Are you sure you mean ‘zip’ files and not ‘gzip’ files? They are very
different.
‘zip’ files are multi-component archives (originating from the DOS world as
‘pkzip’). I didn’t think that ruby-zlib could create them.
‘gzip’ compresses a single stream. It is possible to concatenate several
gzip files just by putting them one after the other, but when you decompress
it you’ll just back a single stream. It’s up to you to put your own
demarcation between files, gzip just sees it all as a stream of bytes.
< as I can input more a stream of a file (string) it is
easy to zip one file but several? I found a way but that is by bypassing
the command to the console and execute tar. this is not a nice way and I
want to avoid it if possible.
‘tar’, ‘cpio’ and ‘zip’ are three separate command-line tools which generate
three different types of multi-file archive. I think that if you already
have several files in a directory, then calling one of these external
programs is the easiest way to create one of these archives.
I notice in RAA a module ‘tarsimple’ which can generate tar files, but I
think it just calls the external command anyway.
Cheers,
Brian.
···
On Tue, Jul 01, 2003 at 01:45:14AM +0900, Andreas Schrafl wrote:
I want to compress a some files in a directory and move them to one
file. It is for a database and the compression type is zip. so now
what I don’t know is how to zip more than one file. what is the
seperator of a file in zip?
Are you sure you mean ‘zip’ files and not ‘gzip’ files? They are very
different.
I just got a comment that says it has more than one file in these files
and so I tought of zip but probably tar.gz would be the best format.
‘zip’ files are multi-component archives (originating from the DOS
world as’pkzip’). I didn’t think that ruby-zlib could create them.
‘gzip’ compresses a single stream. It is possible to concatenate
several gzip files just by putting them one after the other, but when
you decompress it you’ll just back a single stream. It’s up to you to
put your own demarcation between files, gzip just sees it all as a
stream of bytes.
< as I can input more a stream of a file (string) it is
easy to zip one file but several? I found a way but that is by
bypassing the command to the console and execute tar. this is not a
nice way and I want to avoid it if possible.
‘tar’, ‘cpio’ and ‘zip’ are three separate command-line tools which
generate three different types of multi-file archive. I think that if
you already have several files in a directory, then calling one of
these external programs is the easiest way to create one of these
archives.
I notice in RAA a module ‘tarsimple’ which can generate tar files, but
I think it just calls the external command anyway.
I think I’ll use the tarsimple module since this gives me a nice looking
interface.
Thanks
andy
···
On Tue, 1 Jul 2003 05:29:11 +0900 Brian Candler B.Candler@pobox.com wrote:
On Tue, Jul 01, 2003 at 01:45:14AM +0900, Andreas Schrafl wrote:
Cheers,
Brian.