Created
October 26, 2011 20:16
-
-
Save pgib/1317684 to your computer and use it in GitHub Desktop.
Rename all .haml to .html.haml
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/sh | |
for h in `find . -name '*.haml'`; do | |
if ! echo $h | grep -q ".html.haml"; then | |
hh=`echo $h | sed -e s/.haml/.html.haml/` | |
if [ -e $hh ]; then | |
echo "Can't rename $h to $hh because $hh already exists. :(" | |
else | |
echo "Renaming $h to $hh" | |
git mv $h $hh | |
fi | |
fi | |
done |
You're very welcome! find is one of the handiest utilities, and paired with a shell for loop, it's invaluable!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you! very helpful.