[Hampshire] mmv & wildcard expansion in bash

Top Page

Reply to this message
Author: john lewis
Date:  
To: HantsLUG
Subject: [Hampshire] mmv & wildcard expansion in bash
I came across the mmv command whilst looking to see what
http://debaday.debian.net/ had to offer and thought it would be
useful for renaming a batch of images from my camera from
p1010001.jpg through to p101015.jpg to something a little more useful
like barbecue1.jpg through to barbecue15.jpg

I thought this command would work

mmv "*.jpg" "barbecue#1.jpg"

but I ended up with barbecuep1010001.jpg and so on.

I can't work out what the correct wild card format should be that
will remove the original file name prefix and substitute a new one
with a sequential number. I have looked at the man pages for mmv & sh
and at the LUGwiki page on using regular expressions but am still
confused.

I currently create a new directory for any new batch of images from
my camera to avoid overwriting a previous batch of images. The
camera defaults to using p1010001 for the first image each time it
starts with a blank memory card.

I'd still need to upload the images into a temporary location before
renaming them but that would be simpler than ending up with lots of
sub-directories all with similarly named files.

--
John Lewis
Debian (Sid) with the GeneWeb genealogy package