#!/bin/bash

date > started-finished.txt
mkdir -vp PNG-copies-unoptimized PNG-copies-optimized
cp -rv 91.121.0.217 91.121.0.217-bak

for f in 91.121.0.217-bak/*; do
  file "$f" | grep -q "PNG image data" && cp -v "$f" PNG-copies-unoptimized
done

for f in PNG-copies-unoptimized/*; do
  optipng -log optipng.log -o7 "$f"; mv -v "$f" PNG-copies-optimized
done

date >> started-finished.txt

exit 0
