note
kcott
<p>Given that context, you might want to try something like this technique (untested):</p>
<code>
while (defined($file = readdir(DIR))) {
next unless $file =~ /^(abc)(\d{1,3})(\.html)$/;
rename "$dirname/$file" "$dirname/" . $1 . "0" x (4 - length $2) . $2 . $3;
}
</code>
<p>
I'd also recommend that you try this with a [http://perldoc.perl.org/functions/print.html|print] to ensure you're in the right directory and targetting the correct files before making thousands of changes; then change to [http://perldoc.perl.org/functions/rename.html|rename]. Some error checking/handling might also be useful.
</p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-861371">
<p>-- Ken</p>
</div></div>
1028786
1028978