Created
October 14, 2020 20:41
-
-
Save ryparker/1633c5dc1646a97097e0f224786d0845 to your computer and use it in GitHub Desktop.
Append char to matching dirs
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 | |
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