Padding numbers in filenames
William O'Higgins Witteman
william.ohiggins-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Mon Feb 26 16:46:51 UTC 2007
I have a mess of sequentially numbered files (1.png, 2.png ... 824.png)
that I'd like to pad the filenames of so that they sort prettily
(0001.png, 0002.png ... 0824.png). I thought to use the rename command,
but I'm not getting the results I need, and Google didn't help.
Here's what I tried with rename:
rename -n "s/(\d)\.png/000$1png/" *
This would only catch the first 9 files, but I no that I had the right
method.
I can certainly whip up a quick program in Python or Perl (I could
probably learn enough Ruby in half an hour too, or Lua, or C, or ...
you get the picture) but I was curious where I was going wrong with
rename. Any suggestions? Thanks.
--
yours,
William
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gtalug.org/pipermail/legacy/attachments/20070226/8bb54eb1/attachment.sig>
More information about the Legacy
mailing list