Last active
August 31, 2021 09:33
-
-
Save QuentinBrosse/d091edad3ca5c8ea5f350996a13d576b to your computer and use it in GitHub Desktop.
This script renames all PascalCase python files in the current directory into camel_case version.
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
#!/usr/bin/env bash | |
# This script renames all PascalCase python files in the current directory into camel_case version. | |
# Note: gsed is the GNU sed; on macOS install with `brew install gnu-sed` | |
for path in $(find . -maxdepth 1 -regex '\./[A-Z].*\.py') | |
do | |
pascal_case=$(echo $path | cut -c 3-) | |
camel_case=$(echo $pascal_case | gsed -E 's/([A-Z])/_\L\1/g' | cut -c 2-) | |
git mv $pascal_case $camel_case | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment