Tip #571 Change file extension revisited
And again about file extension changing.There are two tips about this:
#27 - http://www.shell-fu.org/lister.php?id=27
#544 - http://www.shell-fu.org/lister.php?id=544
I'm happy to provide one more variant. It's up to you which one is the most useful.
function chext(){ local fname local new_ext="$1" shift IFS=$'\n' for fname in $@ do mv "$fname" "${fname%.*}.$new_ext" done }
If you place this function into .bashrc, then you may use it like as follows:
chext new_ext *.old_ext chext html `find ~ -iname "*.htm"` find ~ -iname "*.htm" | xargs chext html
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs