#! /bin/bash SRC="/var/data/spielfilme" DST="/var/tmp/spielfilme/webm" for f in $(find "$SRC" \( -name '*.jpg' -prune \) -o -type f -print); do t="${f/$SRC/$DST}" t="${t%.*}.webm" if test -s "${t}"; then continue; fi test -d "${t%/*}" || mkdir -p "${t%/*}" #ffmpeg -i "$f" -b 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 "$t" avconv -i "$f" "$t" if ( ! test -s "${t}" ) && ( test -e "$t" ); then rm "$t" fi done