Search code examples
rubyruby-on-rails-3bin

unzip .bin file programatically in ruby


I have a .bin which i am trying to unzip programatically. The directory is a temp directory in which the.bin file is saved.

I have tried to the following

change the permission of bin files by typing.
chmod -c 777 filenam.bin.
now run the bin file by typing

here is a ruby code which i have

%x(gunzip #{label_path})

using above gunzip gives me this error

unknown suffix -- ignored

I shows error as illegal option c.

Can anyone help. Thanks.


Solution

  • gunzip has an option -S to specify a suffix of the file to be unzipped:

    gunzip -S .bin filenam.bin
    

    The above will produce file filenam in the same directory.