#!/bin/bash #rename file extesions # # rfe.sh old_extensions new_extension # #example: #to rename al *.gif file in working directory to *.jpg # rfe.sh gif jpg ARGS=2 E_BADARGS=65 if [ $# -ne "$ARGS" ] then echo "Usage:`basename $0` old_file_suffix new_file_suffix" echo -e "suffix don't oninclude dot symbol" exit $E_BADARGS; fi for filename in *.$1 # travers list of files ending with 1st argument. do mv $filename ${filename%$1}$2 #strip off part of filename matching 1st argument, #+ then append 2nd argument. done exit 0