Recently I had to convert about 250 RAW image files to PNGs. For neatness, I wanted to convert the upper-case filenames the camera assigned with a lower-case name.
A little bash script-fu is all it took:
clean_pics.sh
#!/bin/bash # Extract from SD Card for i in /Volumes/SDCARD/DCIM/100ND40X/DSC_0*; do filename=$(basename "$i") lower_file="$(echo $filename | tr '[A-Z]' '[a-z]')" # verify it doesn't already exist newfile="${lower_file%.*}.png" echo -e "Processingnt$i tont$newfile" if [[ -e $newfile ]]; then echo "****SKIPPING" else convert "$i" "$newfile" fi done echo -e "Detoxing..." find . -iname "*.png" -exec detox "{}" ; echo "Procedure complete."
(“SDCARD”, etc is the path to the source files)
Once the script was up and running, it took about 1/2 hour to process all the files. Meanwhile, I was off doing something else!