Last active
December 17, 2015 10:28
-
-
Save cdracars/5594846 to your computer and use it in GitHub Desktop.
Drupal Module Rename Code.
This file contains 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 | |
# Module Rename script. Written by cdracars 2013 | |
NAME=`find . -type f -name *.module | cut -c 3- | cut -d'.' -f1` | |
echo "Please enter a new name for the module." | |
read VAR | |
VAR1='windows' # String to be found. | |
VAR2='liniux' # String that will replace found string. | |
# Replace all instances of found string in file names. | |
for f in *; do | |
mv $f `echo $f | sed "s/$NAME\(.*\)/$VAR\1/g"`; | |
done | |
# Replace all instances of found string in content of files. | |
grep -rl $NAME ./ | xargs sed -i '' "s/$NAME/$VAR/g" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment