Created
March 23, 2014 21:20
-
-
Save cnunciato/9730034 to your computer and use it in GitHub Desktop.
Finds and deletes JPG sidecar files with corresponding DNGs
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
require 'find' | |
require 'fileutils' | |
tested = matched = jpgs = 0 | |
Find.find('/Volumes/Media/Lightroom/') do |path| | |
if path.match(/\.dng$/i) | |
jpg_path = path.gsub('.dng', '.jpg') | |
if File.exists?(jpg_path) | |
FileUtils.rm(jpg_path) | |
jpgs += 1 | |
end | |
matched += 1 | |
end | |
tested += 1 | |
end | |
puts "#{tested} files tested, #{matched} DNGs, #{jpgs} JPGs deleted." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment