#!/bin/bash CWD=`pwd` SRCFOLDER="freedroid_optiforce" LOGFILE="${CWD}/FD_opti.log" cd ${SRCFOLDER} if [[ -e "${LOGFILE}" ]] then rm "${LOGFILE}" fi ALL_TIME_START=`date "+%s"` for image in *.png do TIME_START=`date "+%s"` optipng -o7 -clobber -fix -force "${image}" >>"${LOGFILE}" 2>&1 TIME_STOP=`date "+%s"` TIME_DIFF=$(($TIME_STOP-$TIME_START)) date -u -d @"$TIME_DIFF" +'%-Mm %-Ss%n' >>"${LOGFILE}" done ALL_TIME_STOP=`date "+%s"` ALL_TIME_DIFF=$(($ALL_TIME_STOP-$ALL_TIME_START)) date -u -d @"$ALL_TIME_DIFF" +'%-Mm %-Ss%n' >>"${LOGFILE}" cd ${CWD} exit 0