#!/bin/rc
targ=()
fn sigint quit{
if(test -d $targ)
rm $targ>[2=]
}
fn datefmt{
x=`{date}
m=(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
for(i in `{seq -w 1 12})
if(~ $m($i) $x(2))
j=$i
n=$x(3)
if(~ $n ?)
n=0$n
echo $x($#x)^$j$n
}
if(! test -d /n/camera)
camera:
9fs other
old=`{
cd /n/other/pictures
echo 20*/*.jpg |
tr ' ' '\x0a' |
sed 's;.*/([0-9]+)\.jpg;\1;g' |
sort -n
}
cd /n/camera/DCIM/101CANON
f=`{echo *.JPG | tr ' ' '\x0a' | sed 's/IMG_([0-9]+)\.JPG/\1/'}
g=()
for(i in $f)
if(! ~ $i $old)
g = ($g $i)
fmt=`{datefmt}
mkdir -p /n/other/pictures/$fmt
while(~ 1 1){
while(! ~ $#g 0 &&
cp IMG_^$g(1)^.JPG /n/other/pictures/$fmt/$g(1)^.jpg){
g = $g(2-)
}
if(~ $#g 0)
break
# usb sucks.
echo -n 'return after physical usb reset [' ^ $#g ^ ']: '
read>/dev/null
camera:
cd /n/camera/DCIM/101CANON
}
|