Renaming multiple files en masse?

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


Brian Somers <brian at Awfulhak.org> 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.

Tony.
-- 
f.a.n.finch    fanf at demon.net    dot at dotat.at
208 it's a wonderful meat




More information about the Ukfreebsd mailing list