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?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Macsek111
  • 21
  • 1

0 Answers0