Renaming multiple files en masse?

Mark Blackman tmb at sophos.com
Tue Apr 11 23:43:02 BST 2000


sorry couldn't resist..(as its only a suffix change..)

sh -c 'for fname in *.html ; do mv $fname ${fname%.html}.htm ; done'


> 
> Hi folks,
> 
> OK, this is a really dumb question (but hopefully an easy one)..
> 
> Could some kind person tell me how to rename multiple files en masse?
> 
> I'm not too much of a shell wizard, and was wondering how I would quickly
> knock together a script to do this.
> 
> 
> To give an example (well, actually _the_ specific example ;-) I need to
> rename a directory full of .html files into .htm files (ugh, I know).
> 
> And I don't really know where to start..
> 
> And what I suppose is really the meta-question behind the question: can
> anybody point me in the direction of some good shell tutorials online 
> (or should I just fork out on a shelf-full of O'Reilly Nutshell guides? ;-)
> 
> 
> Thanks in advance,
> 
> 
> David.
> 
> 
> -- 
> David Marsh,drmarsh at bigfoot.com | http://www.viewport.co.uk/          |
> Glasgow, Scotland.              | If urgent, phone: +44 77-121-848-90 |
> >Trim quotes b4 replying; Quote 1st, reply 2nd; Ask b4 attaching files<
> 
> ------ FreeBSD UK User's Group  -  Mailing List ------
> http://listserver.uk.freebsd.org/mailman/listinfo/freebsd-users
> 




More information about the Ukfreebsd mailing list