When shooting for the nightclub photo booth areas I run, I have to shoot JPEG because my printer will not deal with camera raw files, however, for reasons that should be obvious to any serious digital photographer, I prefer to have to raw files to work with after the fact. This necessitates shooting RAW+JPG, but I have no use for the JPEGs in post-processing.
Because I prefer rely on other automated processes (and am adding more all the time) to make things quicker and easier) and sometimes will shoot some JPEG-only files with no raw and for a couple other reasons I wanted to automate removing the JPEG files only if there is a matching camera raw file.
The script is written for ".ORF" (the Olympus camera raw extension) but could be modified to whatever is necessary. It could also be modified to include XML sidecar files if you're interested in cleaning up a directory where the XML sidecar files are not needed.
#!/bin/bash FILES=${1%/} FILES=${FILES:-.} echo echo "Deleting JPEG sidecars from $FILES" for f in $FILES/* do filename=$(basename "$f") extension="${f##*.}" extension=$(echo $extension | tr "[:upper:]" "[:lower:]") filename="${f%.*}" # orf is the Olympus RAW file extension, change to match your needs, use lower case if [ "$extension" = "orf" ]; then rmfile="`ls $filename.* | grep -i '\(\.jpg\|\.jpeg\)'`" if [ $rmfile ]; then echo echo -ne "Removing sidecar $rmfile" rm $rmfile else echo -ne "." fi fi done echo