Created
March 29, 2024 16:23
-
-
Save jubishop/f197bbfa385aa4d9447560dc66325cde to your computer and use it in GitHub Desktop.
This file contains hidden or 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 'set' | |
files = Dir.glob('**/*.ARW') + Dir.glob('**/*.RAF') | |
files.each { |old_file| | |
new_file = "#{File.join(File.dirname(old_file), File.basename(old_file, File.extname(old_file)))}.heic" | |
if File.exist?(new_file) | |
puts "Deleting #{old_file}" | |
File.delete(old_file) | |
else | |
puts `sips -s format heic "#{old_file}" -s formatOptions best --out "#{new_file}"` | |
end | |
} | |
puts "All existing extensions:" | |
files = Dir.glob('**/*').filter { |path| File.file?(path) } | |
extnames = Set.new | |
files.each { |file| | |
extnames.add(File.extname(file)) | |
} | |
puts extnames.to_a.join(",") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment