title: How to zip a folder which contains sub folder in it in ruby
body: <p>Below method i have tried. In this all the subfolders(subfolder1,..2) contains few folders and files. This method is creating zip file with all the subfolders but all the subfolders are empty. It is not having any folders or files.</p>
  
  <p>def zip_file</p>
  
  <pre><code>  require 'zip'
  
    folder = "D:/my_folder"
  
    input_filenames = ['subfolder1', 'subfolder2', 'subfolder3']
  
    zipfile_name = "D:\\my_folder.zip"
    Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
      input_filenames.each do |filename|
        zipfile.add(filename, File.join(folder, filename))
      end
    end
  end
  </code></pre>