Class: EachDirZip::Cli
- Inherits:
-
Thor
- Object
- Thor
- EachDirZip::Cli
- Defined in:
- lib/each_dir_zip/cli.rb
Instance Method Summary collapse
Instance Method Details
#compress(path = Dir.pwd) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/each_dir_zip/cli.rb', line 9 def compress(path = Dir.pwd) dir_name_list = Dir::entries(path).reject { |p| p == "." || p == ".." }.select { |p| File.directory?("#{path}/#{p}") } dir_name_list.each do |dir_name| target_dir = "#{path}/#{dir_name}" system("zip -r9 '#{target_dir}.zip' '#{target_dir}'") FileUtils.remove_dir(target_dir) end end |