#!/bin/sh
oldsuffix="txt"
newsuffix="sql"
dir=$(eval pwd)
function getdir(){
for element in `ls $1`
do
dir_or_file=$1"/"$element
if [ -d $dir_or_file ]
then
getdir $dir_or_file
else
suffix=$(ls ${dir_or_file} | cut -d. -f2)
echo "$suffix \n"
if [ "$suffix" = "txt" ]
then
name=$(ls ${dir_or_file} | cut -d. -f1 )
mv $dir_or_file ${name}.${newsuffix}
fi
fi
done
}
root_dir="/Users/me/xxx/temp_whole_253_OSS-KEY-lfhbcxrsjrx26p5n20c8zz28"
getdir $root_dir
05-06
3362
