Created
November 20, 2014 03:35
-
-
Save bquistorff/f2a992123fad88386205 to your computer and use it in GitHub Desktop.
Batch renames SVN files
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 | |
# renames files (and svn mv's them if in svn) | |
# not sure if this works if there is whitespace in these vars | |
# use from base of project | |
findstr=$1 | |
replacestr=$2 | |
# It currently doesn't search in hidden folders | |
# for no recursion, use: | |
# for i in * | |
find . -not -path '*/\.*' -type f -name "*$findstr*"|while read i; do | |
#echo $i | |
new_name=`echo $i | sed s/$findstr/$replacestr/g` | |
svn mv $i $new_name | |
# Todo: If not in subversion still rename somehow | |
mv $i $new_name | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment