Rename multiple files at once

Stephen R Laniel steve at laniels.org
Fri Dec 2 19:57:05 UTC 2005


On Fri, Dec 02, 2005 at 02:48:44PM -0500, Stephen Ryan wrote:
> One other thing: if your files aren't completely randomly-named and there's a
> piece of the filename that you need to keep, (i.e., you want to rename
> DSCF00012.jpg to 12.jpg) check out mmv (it's in universe).

For that matter, if you have that kind of pattern, you can
just use the 'rename' command:

rename 's/^DSCF//g ; s/^0+//g' *.jpg

The first command inside the quotes strips off the leading
DSCF; the second command strips off leading zeroes, so that
'00012' becomes '12'.

I've not tested the above, but it probably does what you
want.

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20051202/8ea9e997/attachment.sig>


More information about the ubuntu-users mailing list