Last active
November 24, 2020 18:11
-
-
Save mikequentel/6bc43299f4e2d73d53b5b3bc18009fc0 to your computer and use it in GitHub Desktop.
rn.sh -- git mv to rename files by a source pattern and an expected output pattern
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 | |
# based on: | |
# https://stackoverflow.com/questions/9984722/git-rename-many-files-and-folders | |
OLD_PATTERN=$1 | |
NEW_PATTERN=$2 | |
for file in `git ls-files | grep "$OLD_PATTERN"`; do git mv -k $file `echo $file | sed -e "s|$OLD_PATTERN|$NEW_PATTERN|g"`; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment