把模板項目A重命名項目B

echo "usage : "
echo "        normalize project1 project2"

if [ $# -lt 2 ]; then
   exit -1
fi

echo "mv folder...."

find . | while read file
do
  nfile=`echo "$file" | sed "s/$1/$2/g"`
  if [ `echo "$file" | grep -s $1` ]; then
      if [ -e "$file" ]; then
         nfile=`echo "$file" | sed "s/$1/$2/g"`
         mkdir -p `dirname "$nfile"`
         echo "mv file [$file] to [$nfile]"
         mv "$file" "$nfile"
      fi
  fi
done

echo "sed files...."
find . -type f -name "*.properties" -o -name "*.java" -o -name "*.xml" | while read file
do
   sed '1,$s/'$1/$2"/g" "$file" > "${file}_temp_normalize"
   mv "${file}_temp_normalize" "$file"
done

echo "complete"
相關文章
相關標籤/搜索