#!/bin/bash set -e files=$(find . -type f -not -iwholename "*.git*" -not -name "README.md" -not -name "put.bash" -not -name "hashes.txt") user=ftp@martlubbers.net:$(pass ftp.martlubbers.net/ftp@martlubbers.net) for f in $files do origmd5=$(grep "$f" ./hashes.txt | awk '{print $1}') currmd5=$(md5sum "$f" | awk '{print $1}') if [ "$origmd5" = "$currmd5" ] then echo "$f is not changed" else echo "$f is changed" curl -u "$user" -T $f ftp://martlubbers.net/public_html/$f fi done md5sum ./*{,/*{,/*}} > ./hashes.txt || true