Google Grup tidak lagi mendukung postingan atau langganan Usenet baru. Konten lama masih dapat dilihat.

zip a directory, unzip a zip file

378 kali dilihat
Langsung ke pesan pertama yang belum dibaca

itsme213

belum dibaca,
29 Mar 2005, 01.55.4129/03/05
kepada
I have a directory that I want to compress/uncompress using any or zip,
gzip, bz2, etc. What is the easiest way to do this?

I've looked at zlib but could not find something simple and convenient.

Thanks


Stefan Lang

belum dibaca,
29 Mar 2005, 03.54.1129/03/05
kepada

Look at archive-tar-minitar. It's available on RAA and as a RubyGem.

Stefan


Thomas Sondergaard

belum dibaca,
29 Mar 2005, 06.41.0829/03/05
kepada

Or try my rubyzip (http://rubyzip.sourceforge.net). It's available as a
gem too:

gem install rubyzip

Cheers,

Thomas

itsme213

belum dibaca,
29 Mar 2005, 11.47.2529/03/05
kepada
Does rubyzip directly support zipping up a directory into a file, and vice
versa?

Thanks.

"Thomas Sondergaard" <ts_n...@sondergaard.cc> wrote

Austin Ziegler

belum dibaca,
29 Mar 2005, 13.52.4629/03/05
kepada
On Wed, 30 Mar 2005 01:49:47 +0900, itsme213 <itsm...@hotmail.com> wrote:
> Does rubyzip directly support zipping up a directory into a file, and vice
> versa?
>
> Thanks.

It uses the .tar format, but Archive::Tar::Minitar does.

-austin
--
Austin Ziegler * halos...@gmail.com
* Alternate: aus...@halostatue.ca


Thomas Sondergaard

belum dibaca,
30 Mar 2005, 02.33.2030/03/05
kepada

itsme213 wrote:
> Does rubyzip directly support zipping up a directory into a file, and vice
> versa?

Nope, but maybe I should add such methods :-)

Currently you'd do something like the following to zip everything in the
'test' and 'lib' dirs:

Zip::ZipFile::open("all.zip", true) {
|zf|

Dir['{test,lib}/**/*'].each { |f| zf.add(f, f) }

}

To unzip it to the file system again you'd do something like:

OUTDIR="out"

Zip::ZipFile::open("all.zip") {
|zf|

zf.each { |e|
fpath = File.join(OUTDIR, e.name)
FileUtils.mkdir_p(File.dirname(fpath))
zf.extract(e, fpath)
}
}

Cheers,

Thomas

itsme213

belum dibaca,
30 Mar 2005, 13.15.1830/03/05
kepada
Perfect! Thanks, austin & thomas.


"Austin Ziegler" <halos...@gmail.com> wrote in message
news:9e7db9110503...@mail.gmail.com...

0 pesan baru