Renaming multiple files en masse?

Tony Finch dot at
Thu Apr 13 15:11:11 BST 2000

Brian Somers <brian at> wrote:
> > sorry couldn't resist..(as its only a suffix change..)
> > 
> > sh -c 'for fname in *.html ; do mv $fname ${fname%.html}.htm ; done'
> This is the best answer - as it uses no external commands - just the 
> ``mv''.  But bear in mind, most ``sh''s don't do % or # matching.

All POSIX shells do; this includes FreeBSD's sh (ash), bash, and ksh.
Solaris's /bin/sh, and I guess other SysV OSs, is brain dead.

f.a.n.finch    fanf at    dot at
208 it's a wonderful meat

More information about the Ukfreebsd mailing list