Skip to content

Instantly share code, notes, and snippets.

@bquistorff
Created November 20, 2014 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bquistorff/f2a992123fad88386205 to your computer and use it in GitHub Desktop.
Save bquistorff/f2a992123fad88386205 to your computer and use it in GitHub Desktop.
Batch renames SVN files
#!/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