#!/bin/bash mkdir reencoded for v in *.avi; do NEW=`echo "$v" | sed 's/avi/dv/'` ffmpeg -i "$v" -target dv "reencoded/$NEW" done