[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Wildcard renaming of files



On Sat, 11 Nov 2000 csj@mindgate.net wrote:

> I have a bunch of files I want to rename from .html to .htm. Is there
> I way to rename them all at once?
> 
> I remember from my DOS days a command like "ren" (or is it "rename"?)
> that would do the trick. Something like:
> 
> ren *.html *.htm
> 
> What's the Linux equivalent of this trick? mv only renames files
> explicitly. Or is there something in the man page I skipped?

A little bit bash programming...

for $i in *.html ; do mv "$i" "${i:0:${#tmp}-1}" ; done

Yes, I know, that this is quite cryptic ... but unfortunately I'm to tired
to explain it ... I've need some sleep :-)

Nevertheless it should work. Try 'man bash' for more information, but it
is long...

Martin

-- 
Linux - the last service pack you'll ever need.

For public GnuPG-key: finger fluch@vesuri.helsinki.fi



Reply to: