Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. def unzip_file (file_path, destination_path)
  2. begin
  3. Zip::ZipFile.open(file_path) { |zip_file|
  4. zip_file.each { |f|
  5. f_path=File.join(destination_path, f.name)
  6.  
  7. FileUtils.mkdir_p(File.dirname(f_path))
  8.  
  9. zip_file.extract(f, f_path) unless File.exist?(f_path)
  10. }
  11. }
  12. rescue => e
  13. $LOG.error "Error occurred in Utils.unzip_file - #{e}"
  14. end
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement