BASH to fix JPG timestamps

#! /usr/local/bin/bash

# November 23, 2019
# Downloading images from Shutterfly sets all of the file system attributes
# to the download time. This script pulls the createdate attribute from the
# EXIF data and touches the file appropriately. Empty EXIF createdate data
# is filtered.
#
# This script can obviously be used to change the timestamp of any file with
# EXIF data to the createdate.
#


for item in "$@"
do
timestamp=`exiftool -T -createdate "$item" | sed -e s/://g | sed -e "s/ //" | cut -c 1-12`
echo $item - $timestamp
if [ $timestamp != "-" ];
then
touch -t "$timestamp" "$item"
fi
done