blob: f8e2888a2c6c8a8fa13c391475d50d524ed19654 [file] [log] [blame]
david_williams2aec6932009-05-28 16:34:57 +00001#!/bin/sh
2
3# Important: it is assumed this script is ran from the directory
4# that is the parent of the directory to rename
5
6oldname=$1
7newname=$2
8
9function renamefile ()
10{
11# file name is input parameter
12if [[ $1 =~ "(.*)($oldname)(.*)" ]]
13then
14 echo "changing $1 to ${BASH_REMATCH[1]}$newname${BASH_REMATCH[3]}"
15 mv "$1" "${BASH_REMATCH[1]}$newname${BASH_REMATCH[3]}"
16
17fi
18
19}
20
21
22echo "Renaming build $oldname to $newname"
23
24fromString=$oldname
25toString=$newname
26replaceCommand="s!${fromString}!${toString}!g"
27
28perl -w -pi -e ${replaceCommand} ${oldname}/*.php
29perl -w -pi -e ${replaceCommand} ${oldname}/*.map
30perl -w -pi -e ${replaceCommand} ${oldname}/*.html
31perl -w -pi -e ${replaceCommand} ${oldname}/*.xml
32perl -w -pi -e ${replaceCommand} ${oldname}/checksum/*
33
34# move directory before file renames, so it won't be in file path name twice
35mv $oldname $newname
36
37for file in `find ./${newname} -name "*${oldname}*" -print `
38do
39 renamefile $file
40done