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?
tr -d '\r' < script > script_fixed
– Cyrus Mar 14 '15 at 08:11\r
) from DOS, presumably... – jasonwryan Mar 14 '15 at 08:12