-
Notifications
You must be signed in to change notification settings - Fork 0
/
tes2gpx.sh
37 lines (31 loc) · 1.22 KB
/
tes2gpx.sh
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
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# ------------------------------------------------------------------------------------------------
#
# Das Skript durchsucht das aktuelle Verzeichnis und alle darin enthaltene Unterverzeichnisse
# nach TES-Dateien und wandelt diese in GPX-Dateien um, sofern diese nicht schon vorhanden sind.
#
# ------------------------------------------------------------------------------------------------
#
# This script searches recursivly for Wintecs TES-files and converts them to gpx, using gpsbabel
#
# ------------------------------------------------------------------------------------------------
if [[ ("$1" == "-h") || ("$1" == "--help") ]]; then
echo "Convert TES-files to gpx-files"
echo "no Paraneter = search for TES files and convert them all"
echo "-d = delete TES file after conversion "
exit
fi
DELETE_TES="$1"
GPSBABEL=/usr/bin/gpsbabel
for INFILE in `find . -type f -iname "*.TES"`; do
OUTFILE=${INFILE%.*}.gpx
if [[ ! -f $OUTFILE ]]; then
echo "Converting $INFILE to $OUTFILE ..."
$GPSBABEL -i wintec_tes -o gpx "$INFILE" "$OUTFILE"
if [[ "$DELETE_TES" == "-d" ]]; then
if [[ ($? -eq 0) && (-f "$OUTFILE") ]]; then
rm "$INFILE"
fi
fi
fi
done