Batch change creation dates based on file names using setFile So I tried modifying the command I found here:  to work with my date format: 2015-12-31 22.07.29 and using setFile -d instead of touch.

Here's my script

for f in *; do
t="${t%%.*}"
t=“${t%%-*}”
m=“${t:5:2}”
d=“${t:8:2}”
y=“${t:0:4}”
h=“${t:11:2}”
m=“${t:14:2}”
s=“${t:17:2}”
date=“$m/$d/$y $h$m$s”
setFile -d $date "$f"
done


I try running the command in the folder with jpegs that have the wrong creation date but i get this error over and over

-bash: “”“”??: command not found
ERROR: invalid date/time


I'm a total noob when it comes to using terminal so I have no idea what's wrong with the formatting and what is causing the other error. Does anyone here know what I'm doing wrong?
To me it looks like the problem is with the quotes. Try to copy paste this into your script:

for f in *; do
t="${t%%.*}"
t="${t%%-*}"
m="${t:5:2}"
d="${t:8:2}"
y="${t:0:4}"
h="${t:11:2}"
m="${t:14:2}"
s="${t:17:2}"
date="$m/$d/$y $h$m$s"
setFile -d $date "$f"
done