Re: adding leading zeros to a filename

From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 01/28/05


Date: 28 Jan 2005 19:38:12 GMT

On Fri, 28 Jan 2005 at 19:31 GMT, rupert wrote:
> I've tried unsuccessfully to find the answer to this, so am hoping
> someone here can help...
>
> I've got a directory of photos called:
>
> 1.jpg
> 2.jpg
>
> ....
>
> 10.jpg
> 11.jpg
>
> ...
>
> 100.jpg
> 101.jpg
>
> ...
>
> and I can't for the life of me work out how to write a script to add
> leading zeros to the filenames so they are in the form
>
> 001.jpg
> 002.jpg
>
> ....
>
> 010.jpg
> 011.jpg
>
> ...
>
> 100.jpg
> 101.jpg
>
> ...

   This must be a popular class; this has been asked (and answered)
   several times in the last few days. The class could use a lesson on
   searching the archives.

-- 
    Chris F.A. Johnson                  http://cfaj.freeshell.org/shell
    ===================================================================
    My code (if any) in this post is copyright 2005, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License


Relevant Pages

  • Re: How much should a gardener cost?
    ... >> Rupert wrote: ... >>> I don't use GB but I can see that broken threads will cause ... >>> confusion, although neither Chris or I can find any. ...
    (uk.rec.gardening)
  • Re: Survivor in trouble at work
    ... Last I heard, Rupert makes $800,000/yr talking. ... after he won Survivor with some appearances. ... Chris is probably doing the 'appearance' thing on the side. ... (or other road equipment) ...
    (alt.tv.survivor)
  • Re: Plant Ident and advice please
    ... It's very noticeable that your Yucca is searching for light and has ... Thanks, Rupert. ... hedge. ...
    (uk.rec.gardening)
  • Re: OT American Idol and the forces of evil
    ... At least Chris will be able to create his own music now and not told what ... Where is RUPERT? ... LOL. ... my friends and I called him Hagrid, and in his latest book, Barnett ...
    (rec.gambling.poker)