#!/bin/bash cnt=0 for dff in *; do cnt=$(($cnt+1)); printf "%04d" "$cnt"; echo $dff"=>"$cnt.jpg; mv $dff `printf "%04d" "$cnt"`.jpg done