Re: [Hampshire] mmv & wildcard expansion in bash

Top Page

Reply to this message
Author: Jim Kissel
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] mmv & wildcard expansion in bash


john lewis wrote:
> 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.


mmv "p101*.jpg" "barbecue~1.jpg"

>
> 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.
>


--
Simple effective migration to Open Source based computing

Jim Kissel
Open Source Migrations Limited
w: http://www.osml.eu
e: jim.kissel@???
p: +44(0) 8703 301044
m: +44(0) 7976 411 679