summaryrefslogtreecommitdiffstats
path: root/tracks/rename.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2022-05-03 07:06:20 +0400
committerSuren A. Chilingaryan <csa@suren.me>2022-05-03 07:06:20 +0400
commit90d1bf5893a9a373eccd40693f801aa74c3ad36b (patch)
tree3a6574b7299fcffdb5d52d47d59ec3d3832486d6 /tracks/rename.sh
parent682b308d8a7804d0ae2b2606b3ba0ff8814c1473 (diff)
downloadopenmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.tar.gz
openmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.tar.bz2
openmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.tar.xz
openmtbmap-90d1bf5893a9a373eccd40693f801aa74c3ad36b.zip
Regularly update cookie jar; update map paths; include gpx scripts
Diffstat (limited to 'tracks/rename.sh')
-rw-r--r--tracks/rename.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/tracks/rename.sh b/tracks/rename.sh
new file mode 100644
index 0000000..e1504a9
--- /dev/null
+++ b/tracks/rename.sh
@@ -0,0 +1,15 @@
+#! /bin/bash
+
+mkdir -p GPX/Archive
+
+for name in $(ls Route*.gpx Track*.gpx 2>/dev/null); do
+ new_name=$(cat "$name" | grep -oP "(?<=<name>).*?(?=</name>)" | head -n 1 | sed -e 's/[^0-9a-zA-Z]\+/_/g').gpx
+ if [[ "$name" =~ ^Route ]]; then
+ new_name="GPX/$new_name"
+ else
+ new_name="GPX/Archive/$new_name"
+ fi
+ echo "Renaming: $name to $new_name"
+ mv "$name" "$new_name"
+done
+[ -f Waypoints.gpx ] && mv Waypoints.gpx GPX/