Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge all .gpx files within a folder into one file with GPSbabel

I want to use GPSbabel to merge all single .gpx files within one folder into one file called for example merge.gpx how can i archive something like this?

I know how to do it manually:

gpsbabel -i gpx -f "folder/of/file/1.gpx" -f "folder/of/file/2.gpx" -f "folder/of/file/3.gpx" -o gpx -F "folder/of/file/merge.gpx"

But because there are up to 20 such files within one folder i would like to use a batch (.bat) file to do this automatically? I'm nearly completely new to batch files and could not find any information how to archive that.

like image 575
Kitumijasi Avatar asked Dec 25 '22 03:12

Kitumijasi


1 Answers

For Linux, you could use the following bash script:

#!/bin/bash

cd /folder/of/file
ff=""
for f in *.gpx
do 
    ff="$ff -f $f"
done
gpsbabel -i gpx $ff -o gpx -F "All.gpx"
like image 115
Aecturus Avatar answered Feb 09 '23 18:02

Aecturus