2

I want to sort about 2500 images every day into folders with a timestamp. So far I have this script but it's not working....

for x in *.jpg; do
d=$(date -r "$x" +%Y-%m-%d)
mkdir -p "$d"
mv -- "$x" "$d/"
done

The error is:

/home/pi/BRAVO/sort.sh: line 1: syntax error near unexpected token `$'do\r''
'home/pi/BRAVO/sort.sh: line 1: `for x in *.jpg; do

Any solution to this problem or a similar script?

0 Answers0