Sha256: 21beff690301542498370a3b622c6327a165232a282badafcf932f4cce0a9080
Contents?: true
Size: 560 Bytes
Versions: 1
Compression:
Stored size: 560 Bytes
Contents
require "thor" module EachDirZip class Cli < Thor package_name "dir_zip" default_command :compress desc "compress TARGET_DIR", "Each under target_dir compress directories" 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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
each_dir_zip-0.0.1 | lib/each_dir_zip/cli.rb |