Saturday 22 November 2014

Rename files numerically

Batch renaming files in folder sequentially.
e.g. several .png files.

This example has is a pad of 4 ( 0004.png )

Create script with or cd to directory and run


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




No comments:

Post a Comment