Created
January 31, 2014 05:22
-
-
Save phun-ky/8726964 to your computer and use it in GitHub Desktop.
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
# Rename multiple files | |
# http://www.24hourapps.com/2009/03/linux-tips-10-rename-multiple-files.html | |
# https://gist.github.com/alobato/397988 | |
# | |
# Found the orignal gist very helpfull, and tweaked it to fit git mv | |
# First I suggest you test the outcome before you do the renaming, with a dry run (-n) | |
for f in $(git ls-files | grep %filestomatch%); do git mv -n "${f}" "${f/%filestomatch%/%newfilename_orlocation%}"; done; | |
# If you are happy with the result, execute ( remove -n ) | |
for f in $(git ls-files | grep %filestomatch%); do git mv "${f}" "${f/%filestomatch%/%newfilename_orlocation%}"; done; | |
# It is quite a long command, but it basically executes a loop and tells it to take each f file | |
# name in the grepped result from git ls-files and give it a name where a match for %filestomatch% is replaced with %newfilename_orlocation%. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment