Jul. 2nd, 2012

mbarrick: (Default)

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 writter 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 

\240


Source: http://www.mbarrick.net/blog/120702/bash-script-removing-jpeg-sidecar-files

January 2026

S M T W T F S
    123
45 67 8910
11 121314 15 16 17
18 19 20 21 22 2324
25262728293031

Expand Cut Tags

No cut tags
Page generated Jan. 26th, 2026 09:55 pm
Powered by Dreamwidth Studios