Thursday, October 31, 2013

Simple shell script to import photo's from SD card.



cd /cygdrive/c/DCIM
for i in e f g h i j k l m
do
thisTarget="/cygdrive/${i}/DCIM"
if [ -d "$thisTarget" ]; then
thisDate=$(date +%y%m%d)
if [ -d "$thisTarget/100ND610" ]; then
mv "$thisTarget/100ND610" "$thisTarget/$thisDate"
fi
mv -f $thisTarget/1* .
for jj in $(ls -d $thisTarget/* | xargs -n1 basename)
do
for kk in _1 _2 _3 _4
do
if [ -d $jj$kk ]; then
echo $jj$kk
else
mv -f $thisTarget/$jj  $jj$kk
break
fi
done
done
rmdir $thisTarget
fi
done
find . -type d -exec rmdir --ignore-fail-on-non-empty -p {} \;
find . -name "DSC*.JPG" -ls -exec exifautotran {} \;
find . -name "IMG*.JPG" -ls -exec exifautotran {} \;
find . -name "DSC*.JPG" -ls -exec exiftool  -d %Y.%m.%d-%H.%M%%-c.%%e "-filename<CreateDate" {} \;
find . -name "DSC*.NEF" -ls -exec exiftool  -d %Y.%m.%d-%H.%M%%-c.%%e "-filename<CreateDate" {} \;
find . -name "IMG*.PEF" -ls -exec exiftool  -d %Y.%m.%d-%H.%M%%-c.%%e "-filename<CreateDate" {} \;
find . -name "IMG*.CR2" -ls -exec exiftool  -d %Y.%m.%d-%H.%M%%-c.%%e "-filename<CreateDate" {} \;
find . -name "IMG*.DNG" -ls -exec exiftool  -d %Y.%m.%d-%H.%M%%-c.%%e "-filename<CreateDate" {} \;
find . -name "IMG*.JPG" -ls -exec exiftool  -d %Y.%m.%d-%H.%M%%-c.%%e "-filename<CreateDate" {} \;
find . -name "P*.JPG" -ls -exec exiftool  -d %Y.%m.%d-%H.%M%%-c.%%e "-filename<CreateDate" {} \;

No comments:

Post a Comment