Skip to content

Instantly share code, notes, and snippets.

@externvoid
Last active December 7, 2016 00:46
Show Gist options
  • Select an option

  • Save externvoid/0a95d29de2c43b36f93f6c5b7aa98dde to your computer and use it in GitHub Desktop.

Select an option

Save externvoid/0a95d29de2c43b36f93f6c5b7aa98dde to your computer and use it in GitHub Desktop.
便利ツール2、プロジェクト名の変更
#!/bin/bash
renameDirectories () {
for i in `find . -name \*$oldProject\* -type dir`
do
oldFile=$i
newFile=`echo $i | sed -e s/$oldProject/$newProject/g`
echo "mv $oldFile $newFile"
mv $oldFile $newFile
done
}
renameFiles () {
for i in `find . -name \*$oldProject\* -type file`
do
oldFile=$i
newFile=`echo $i | sed -e s/$oldProject/$newProject/g`
echo "mv $oldFile $newFile"
mv $oldFile $newFile
done
}
renameWords () {
for i in `grep -slr $oldProject *`
do
echo $i
sed -i '' "s/$oldProject/$newProject/g" $i
done
}
main () {
oldProject=$1
newProject=$2
cp -pr $oldProject $newProject
cd $newProject
renameDirectories
renameFiles
renameWords
cd ..
}
main $1 $2
exit
# Xcodeのプロジェクト名を変更するスクリプト(複製してプロジェクト名を変更)
# http://qiita.com/menomoto/items/b484a3187e9d29ed3bde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment