#!/bin/bash -x ########################## ######## The script give the names of the infiles, outfile and ######## intermediate file that the imagemagick scripts will be ######## processing ########################## trap "rm -f *.list *.mpc *.cache" 1 2 3 15 trap "exit 0" 2 # Calls each infile from the infolders listed in the file created by the master CallFiles () { while [ $FOLDER1 -le $FOLDER2 ]; do FOLD_NAME=`awk -v pat="in$FOLDER1" '$0 ~ pat {print $2}' folder.list` # Check for the current folder name FILES=`awk -v pat="in$FOLDER1" '$0 ~ pat {print $3}' folder.list` # Check how many files there are in that folder eval COUNTIN=$1 RenameIn FOLDER1=`echo $FOLDER1|sed 's/^0*//'` # Zero needs to be taken away so 08 and 09 are recognized FOLDER1=$(( FOLDER1 + 1)) # Makes sure the next folder is called FOLDER1=`printf "%02d" $FOLDER1` # Add 0 infront so that awk doesnt confuse teens with 1 shift done RenameOut } # Names each of the infiles from a folder. Once all files have been # called returns to file 1. Writes the current infile and its number # to a special file called "caller.list" RenameIn () { if [ $COUNTIN -le $FILES ]; then eval infile=$FOLD_NAME/`printf "%03d" $COUNTIN`.png COUNTIN=$(( COUNTIN + 1 )) echo "$infile $COUNTIN">>caller.list else eval infile=$FOLD_NAME/`printf "%03d" 1`.png COUNTIN=1 echo "$infile $COUNTIN">>caller.list fi } # Gives a name to each output file and writes its name to the caller # file. If there is no "ripples" effect, only an outfile name is # created. If there is a "ripples" effect, an intermediate file is # also given. RenameOut () { if [ $comp_ripple = no ]; then outfile=$OUTFOLDER/`printf "%04d" $COUNT`.png echo "$outfile">>caller.list else outfile1=preripple.mpc outfile2=$OUTFOLDER/`printf "%04d" $COUNT`.png echo -e "$outfile1 \n$outfile2">>caller.list fi } >caller.list # erases caller file CallFiles $1 $2