#!/bin/sh # # $Id: iRename,v 1.1 2001/11/20 03:11:28 vijoy Exp vijoy $ # # Cleanup and create input inputfile=`ls *.jpg *.JPG` for imgname in $inputfile do if [ ! -f $imgname ]; then echo $imgname" not found." break fi # Extracting image information info=`head $imgname| strings| grep 200 | grep :` newname=`echo $info|cut -d ' ' -f 1`"++"`echo $info|cut -d ' ' -f 2` newname=`echo $newname|sed s/:/-/g` # Uncomment for lost time-date information # newname=2001-11-04++00-00-`echo $imgname|cut -d '.' -f 1|cut -d '0' -f 2-` # Rename only if valid newname if [ "X$newname" != "X++" ]; then mv -i $imgname $newname fi done rm -rf .input