#!/bin/bash -eu
base="$1"
i="$2"
ext="$3"
shift 3
for file; do
	dest="$base`printf %03d $i`.$ext"
	if [ "$file" != "$dest" ]; then
		mv -iv "$file" "$base`printf %03d $i`.$ext"
	fi
	i=$[i+1]
done
