Skip to content

Instantly share code, notes, and snippets.

@pgib
Created October 26, 2011 20:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgib/1317684 to your computer and use it in GitHub Desktop.
Save pgib/1317684 to your computer and use it in GitHub Desktop.
Rename all .haml to .html.haml
#!/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
@chadb
Copy link

chadb commented Feb 21, 2012

thank you! very helpful.

@pgib
Copy link
Author

pgib commented Feb 21, 2012

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