Skip to content

Instantly share code, notes, and snippets.

@venj
Created December 22, 2015 08:48
Show Gist options
  • Save venj/4bca80cbc083c26f6677 to your computer and use it in GitHub Desktop.
Save venj/4bca80cbc083c26f6677 to your computer and use it in GitHub Desktop.
#!/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