Skip to content

Instantly share code, notes, and snippets.

@mmrobins
Created December 10, 2019 07:29
Show Gist options
  • Save mmrobins/4e4d8577f2b0a8c3175ce0a89a036b42 to your computer and use it in GitHub Desktop.
Save mmrobins/4e4d8577f2b0a8c3175ce0a89a036b42 to your computer and use it in GitHub Desktop.
set photo exif timestamp based on directory name
for dir in */; do;
year=`echo $dir | sed 's/\([0-9]\{4\}\).*/\1/'`
month=`echo $dir | sed 's/[0-9]\{4\}\([0-9]\{2\}\).*/\1/'`
echo "year $year"
echo "month $month"
exiftool -P -overwrite_original_in_place "-datetimeoriginal=$year:$month:01 12:00:00" "$dir"/*
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment