Well, its working (for those out there that stumble across this site for a similar script)
Its not elegant, sane or other ... but it works.
If the better experienced here can clean it up and solve the elegant/sane issues then it would be great
Code:
#!/bin/bash -x
for file in *.jpg; do
YY=`echo $file | awk '{split($0,a,""); print a[1]a[2]}'`
MM=`echo $file | awk '{split($0,a,""); print a[3]a[4]}'`
DD=`echo $file | awk '{split($0,a,""); print a[5]a[6]}'`
HH=`echo $file | awk '{split($0,a,""); print a[7]a[8]}'`
if [ -d $YY ]
then
if [ -d $YY/$MM ]
then
if [ -d $YY/$MM/$DD ]
then
if [ -d $YY/$MM/$DD/$HH ]
then
mv $YY$MM$DD$HH*.jpg $YY/$MM/$DD/$HH
else
mkdir $YY/$MM/$DD/$HH
fi
else
mkdir $YY/$MM/$DD
fi
else
mkdir $YY/$MM
fi
else
mkdir $YY
fi
done