summaryrefslogtreecommitdiff
path: root/scripts/xml-rename
blob: 03444293f50b3fb3d1b23f6046cb7b8f28725a0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /bin/bash

# This script can be used to rename an xml file or directory for all
# translations.
# (Script could be expanded to really move to another location.)

SOURCE="$1"
NEWNAME="$2"

[ "$SOURCE" ] || exit 1
[ "$NEWNAME" ] || exit 1


if [ ! -e "en/$SOURCE" ]; then
	echo "Source file does not exist"
	exit 1
fi
if echo "$NEWNAME" | grep -q "/"; then
	echo "New name may not contain a directory"
	exit 1
fi

for FILE in */$SOURCE; do
	FDIR="$(dirname $FILE)"
	git mv $FILE $FDIR/$NEWNAME
done