On Saturday 28 January 2006 21:49, Anders Johansson wrote:
Rikard Johnels wrote:
Hello all.
Problem: I plan to rename a few thousand photos with names like imgp4711.jpg and imgp0042.pef to a date indexed version: yyyy-mm-dd_hh-mm-ss_nnnn.type where nnnn is a running number from the exif header. and type is the original filetype (.jpg, .pef, .tif etc)
...Lines cut...
The simplest would be to assign the values to variables, for example
IMGDATE=`exiftool -f -S -s -Date filename` IMGTIME=`exiftool -f -S -s -Time filename` IMGFRAME=`exiftool -f -S -s -FrameNumber filename` IMGEXT=${filename##*.}
and then do something like
if [ "$IMGDATE" = "-" ]; then mv filename `date`-0000.$IMGEXT else mv filename $IMGDATE-$IMGTIME-$IMGFRAME.$IMGEXT fi
Untested, but I think the solution will be something in this direction.
Hi Anders. This implies running the exiftool three times to get the variables filled, right? As exiftool is quite slow in execution i would have hoped to refrain from running it more than once in my script. But i will surely look into this approach and do some experimenting. -- /Rikard ----------------------------------------------------------------------------- email : rikard.j@rikjoh.com web : http://www.rikjoh.com mob : +46 (0)736 19 76 25 ------------------------ Public PGP fingerprint ---------------------------- < 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78 46 1C EE 56 >