#!/bin/sh

# giving the files the times as contained originally within their body
# VALID for 2000 ONLY, by skipping the first line, it works for Olympus as well

if [ -e d ]
then
 echo The directory d exists already, quitting
 exit
fi 

mkdir d

for F in *.jpg 
do 
sed -n "1d ; /2000/{s/2000//; s/[: ]//g; s/[[:cntrl:]]/ /g ; s/.. 2000.*// ; s/ //g ; \
    s/^/touch -t 2000/; s/$/ ..\/$F/p ; q;}" $F >d/$F 
done

cd d

for F in *.jpg 
do chmod +x $F ; ./$F #; rm $F
done

cd ..
#rmdir d
