#!/usr/bin/zsh #in a zsh shell jhead -autorot targetdirectory/**/* works for rotating #all files in all subdirectories jhead -autorot "$1/**/*" #!/bin/sh #not sure if the following is how it's supposed to be done: comd=find "$1" -name *.JPG for comd do output+=$(jhead -autorot "$arg") done