#!/usr/bin/csh -f # Renaming Multiple files # Created by Young Sung # Aug. 22, 2002 if ( $#argv != 2 ) then echo "usage: bm pattern_want_to_be_changed new_pattern" echo " No wild cards (*, ?) need" echo " eg: bm .migration. .mig." echo " It will changes all the files with .migration. in it as below" echo " 1234.UKN-UKN-line123.migration.1234.xxx.stack to" echo " 1234.UKN-UKN-line123.mig.1234.xxx.stack" echo " " else echo "" set no = 0 foreach list(`ls *$1*`) set target = `echo $list | sed 's/'$argv[1]'/'$argv[2]'/'` mv -i $list $target echo "$list ->> $target" @ no = ( $no + 1 ) end echo "" echo "Number of files renamed: $no" echo "" endif