From 90d1bf5893a9a373eccd40693f801aa74c3ad36b Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Tue, 3 May 2022 07:06:20 +0400 Subject: Regularly update cookie jar; update map paths; include gpx scripts --- tracks/rename.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tracks/rename.sh (limited to 'tracks/rename.sh') 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 "(?<=).*?(?=)" | 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/ -- cgit v1.2.3