Re: How to rename a long list of photo filenames?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bill Jonas
Date:  
To: plug-discuss
Subject: Re: How to rename a long list of photo filenames?
On Thu, Nov 10, 2005 at 10:59:21PM -0700, Ben Browning wrote:
> rename 's/porngasmica/churchtastic/' *.jpg


Thanks for pointing that out; I wasn't aware of it. Looks like it comes
with Perl, so it should be widely available.

Looping with bash's parameter substitution is still a bit better than
how I was first doing it when I needed to do that sort of thing.

for file in pict*.jpg; do mv $file `echo $file |sed -e 's/^pict/a/'`; done

Of course, that's the most portable way doing it entirely in the shell
(for Bourne-style shells, of course). Also handy if you find yourself
on a {proprietary,ancient} Unix without Perl installed (or without its
rename script).

-- 
Bill Jonas    *        *    http://www.billjonas.com/
"It's a dangerous business, Frodo, going out your front door.  You step
into the Road,  and if you don't keep your feet,  there  is  no knowing
where you might be swept off to."  --  Bilbo Baggins
---------------------------------------------------
PLUG-discuss mailing list - 
To subscribe, unsubscribe, or to change  you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss