a=1 for i in */; do new=$(printf "%05d" ${a}) #05 pad to length of 5 mv ${i} ${new} let a=a+1 done