This is working fine but my question is, how do I extract the zip file’s content into a different directory?
require 'rubygems'
require 'zip/zip'
Zip::ZipFile.open("j.zip") do |zipfile|
zipfile.each do |file|
file.extract
end
end
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Change the Working Directory
There may be other ways to address this issue, but one of the most obvious is to change the current working directory with Dir#chdir. For example, to extract your files into
/tmp: