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?
“
instead of"
, but that is not your only problem with the code! The first line after the for in do,t="${t%%.*}"
is meaningless a thet
variable has yet to be initialized with anything. Base on the linked answer it should be anf
inside of the{...}
not at
. That said though, we can not test further without some sample file names as well as the expected output.