Created
December 22, 2015 08:48
-
-
Save venj/4bca80cbc083c26f6677 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'fileutils' | |
require 'shellwords' | |
include FileUtils | |
#hdiutil makehybrid -iso -joliet -o image.iso /path/to/source | |
ARGV.each do |rootdir| | |
cd rootdir do | |
Dir["*"].each do |subdir| | |
destination = "/Volumes/WD3T/ISOs/#{rootdir.shellescape}/" | |
mkdir_p destination unless File.directory? destination | |
puts "Dealing with \"#{subdir}\": " | |
unless File.directory? subdir | |
copied = system("cp #{subdir.shellescape} #{destination}") | |
rm subdir if copied | |
else | |
result = system("hdiutil makehybrid -iso -joliet -o #{destination}#{subdir.shellescape}.iso #{subdir.shellescape}") | |
rm_rf subdir if result | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment