On my Nexus 5, I started shooting in RAW mode with JPG previews. However, when I copy the DNGs over to my laptop for editing/archival, I don't care about the JPG files.
The camera app creates two files:
filename.jpg
: the JPG previewfilename.dng
: the RAW file
Basically, we want to remove any JPG files for which a RAW file also exists. I just use this bash one-liner (which I run in bash for Windows).
for img in *.jpg; do [[ ! -f "${img%.jpg}.dng" ]] || rm -- "$img"; done
Basically, for each image that matches the *.jpg
globbing pattern, it tests
whether a dng
file does not exist (by stripping off the .jpg
extension
and adding .dng
. If this test succeeds, then the exit code is 0
and the
command doesn't continue. Otherwise, it removes the JPG preview image.