Skip to content

Instantly share code, notes, and snippets.

@ryparker
Created October 14, 2020 20:41
Show Gist options
  • Save ryparker/1633c5dc1646a97097e0f224786d0845 to your computer and use it in GitHub Desktop.
Save ryparker/1633c5dc1646a97097e0f224786d0845 to your computer and use it in GitHub Desktop.
Append char to matching dirs
#!/bin/bash
echo "start"
for fp in `find src/__tests__ -type d`; do
D="$(basename $fp)"
newFp=''
if [[ "${D}" == "GET" ]]; then
newFp="${fp:0:(${#fp}-3)}_${D:(-3)}"
elif [[ "${D}" == "POST" ]]; then
newFp="${fp:0:(${#fp}-4)}_${D:(-4)}"
elif [[ "${D}" == "PUT" ]]; then
newFp="${fp:0:(${#fp}-3)}_${D:(-3)}"
elif [[ "${D}" == "DELETE" ]]; then
newFp="${fp:0:(${#fp}-6)}_${D:(-6)}"
else
continue;
fi
echo "$fp --> $newFp"
git mv "$fp" "$newFp"
done
echo "end"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment