#!/bin/bash

# Copyright (C) 2005.  Kurt Schwehr
# Released under the GPL

# Simple script to delete frames in a sequence that are the same

# Max is one beyond the last frame number
declare -ir max=3005
declare -i  cur=0
#declare -i  cur=2100
declare -i  prev=999999

while [ $cur != $max ]; do
  echo $cur
  curName=`printf "%05d.png" $cur`
  echo $curName
  prevName=`printf "%05d.png" $prev`
  echo $prevName

  cmp $curName $prevName > /dev/null
  result=$?
  if [ "0" == "$result" ]; then
      echo "Same"
      rm -f $curName
  else
      prev=$cur      
  fi
  cur=$[cur+1]
done