<DIV>
<DIV>I have a group of files in a directory as follows:</DIV>
<DIV> </DIV>
<DIV>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'"><FONT face="Courier New">file.1<BR>file.10<BR>file.11<BR>file.12<BR>file.13<BR>file.14<BR>file.15<BR>file.2<BR>file.3<BR>file.4<BR>file.5<BR>file.6<BR>file.7<BR>file.8<BR>file.9</FONT><BR></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'">How would I go about adding a leadin '0' to the files numbered 1-9 to make the files list in order like the following:</SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'"></SPAN> </P><SPAN style="mso-fareast-font-family: 'MS Mincho'">
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'"><FONT face="Courier New">file.01<BR>file.02<BR>file.03<BR>file.04<BR>file.05<BR>file.06<BR>file.07<BR>file.08<BR>file.09</FONT><BR><FONT face="Courier New">file.10<BR>file.11<BR>file.12<BR>file.13<BR>file.14<BR>file.15</FONT><BR></SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'"></SPAN> </P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'">I tried the following:</SPAN></P>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'"></SPAN> </P><SPAN style="mso-fareast-font-family: 'MS Mincho'">
<DIV>------------snip-------------------</DIV>
<DIV>
<P class=MsoPlainText style="MARGIN: 0in 0in 0pt"><SPAN style="mso-fareast-font-family: 'MS Mincho'"><FONT face="Courier New">#!/usr/bin/perl -w<BR>use strict;<BR><BR>my @nums = (1..9);<BR>foreach my $file (glob "file*") {<BR><SPAN style="mso-spacerun: yes"> </SPAN>my $newfile = sprintf "file.%02d", @nums;<BR><SPAN style="mso-spacerun: yes"> </SPAN>rename "$file", "$newfile";<BR>}</FONT><BR></P>
<DIV>------------snip-------------------</DIV>
<DIV></SPAN> </DIV>
<DIV>But, I'm only getting only one file named 'file.01' as the result. What am I doing wrong?</DIV></DIV>
<DIV> </DIV>
<DIV>Ron<BR></DIV></SPAN></SPAN></DIV></DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/search/mailsig/*http://search.yahoo.com">The New Yahoo! Search</a> - Faster. Easier. Bingo.