Sayuj
Sayuj

Reputation: 7622

ruby - bzip files

I want to compress the files in ruby. for example I have file:

base_1.txt
base_2.txt
base_3.txt

I want these files compressed to base.bz

How can I do it in ruby?

Upvotes: 0

Views: 1446

Answers (2)

kwoodson
kwoodson

Reputation: 979

I am not familiar with a standard library function for ruby that performs bz2 operations. There are a few libraries like the one described above from 3rd party.

Ruby also facilitates using the operating systems shell. Assuming Linux: You could call the system call:

system("bzip2 base_1.txt")

or the equivalents:

bzip2 base_1.txt

%x[ bzip2 base_1.txt ]

Upvotes: 0

Michael Kohl
Michael Kohl

Reputation: 66857

Have you looked at this library:

https://github.com/brianmario/bzip2-ruby

Upvotes: 1

Related Questions