How to use Ruby's zlib?

  • Thread starter Moran, Craig M (BAH)
  • Start date
M

Moran, Craig M (BAH)

I would like to add or move a file to a pre-existing gzipped file. Nobu
tipped me off to the fact that Ruby has built in zlib methods. I can't,
however, find any good examples of what I want to do. Specifically, I'd
like to move all *.log files in a directory to a file named Archived.gz.
Help please?
Kindest Regards-
Craig
 
G

Gavin Sinclair

I would like to add or move a file to a pre-existing gzipped file. Nobu
tipped me off to the fact that Ruby has built in zlib methods. I can't,
however, find any good examples of what I want to do. Specifically, I'd
like to move all *.log files in a directory to a file named Archived.gz.
Help please?
Kindest Regards-
Craig

I'd love to say I knew how, but I don't. If you take a look at

http://www.ruby-doc.org/stdlib/libdoc/zlib/rdoc/index.html

you can see what classes and methods are implemented. With
experimentation, you'll probably get somewhere.

Ooops, just looked and saw that there is some documentation alongside
the source code: ext/zlib/doc/zlib.rd. That means it's probably on
the web somewhere; try Google.

Any volunteers for converting this RD documentation into RDoc format
inside the source code? ;)

Cheers,
Gavin

PS. GZip compresses single files, unlike ZIP, which creates compressed
archives. So getting a bunch of files into a .gz file is not feasible
without using TAR. I don't know how people might go about creating
compressed archives with Ruby. I use: system("tar zcvf ...")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top