<p>What is the best way, using Bash, to rename files in the form:</p>

<pre><code>(foo1, foo2, ..., foo1300, ..., fooN)
</code></pre>

<p>With zero-padded file names:</p>

<pre><code>(foo00001, foo00002, ..., foo01300, ..., fooN)
</code></pre>

The following will do it:
```
```
for ((i=1; i<=N; i++)) ; do mv foo$i `printf foo%05d $i` ; done
```
```
EDIT:
changed to use ((i=1,...)), thanks
mweerden
!