File: xml-rename

package info (click to toggle)
installation-guide 20190622
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,344 kB
  • sloc: xml: 45,741; sh: 1,283; perl: 427; awk: 199; makefile: 118; python: 101
file content (26 lines) | stat: -rwxr-xr-x 500 bytes parent folder | download | duplicates (5)
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