Last active
December 7, 2016 00:46
-
-
Save externvoid/0a95d29de2c43b36f93f6c5b7aa98dde to your computer and use it in GitHub Desktop.
便利ツール2、プロジェクト名の変更
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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