Page 1 of 1

Bulk renaming of GPX routes to match filename

Posted: Thu Sep 24, 2020 12:27 pm
by Spiney
I have a large set of downloaded GPX files in a folder and each of which contain a single route. The GPX filenames can of course be easily edited. Using JaVaWa RTK one can see the assigned names of each route extracted from the <name> field inside the file. I want to change the contents of the <name> field to match the GPX filename so they are the same.

At present I either have to import each route into Basecamp, cut and paste the filename into the properties box, then export the route to create a new GPX file with the same name (or of course use a text editor).

Does anyone know of a utility that has the functionality to overwrite the contents of the first <name> field with the filename either singly or preferably as a batch?

Re: Bulk renaming of GPX routes to match filename

Posted: Thu Sep 24, 2020 3:21 pm
by GPSrChive
We use Notepad++ to do large batch editing of text files, which is all any GPX file is. But practice first on a copy of a file to be sure you have everything configured correctly before applying to a large number of files. We have had some extra fun before going back and correcting mistakes!

Re: Bulk renaming of GPX routes to match filename

Posted: Thu Sep 24, 2020 6:13 pm
by Spiney
Thanks gpsrchive - I too use Notepad++ to edit individual text files. Good advice about backups !!

Did you use Notepad++ by running a macro to process a batch of files or did you use a Command line?

Re: Bulk renaming of GPX routes to match filename

Posted: Thu Sep 24, 2020 6:38 pm
by GPSrChive
Notepad++ is very powerful.

We open multiple files, and then search globally for specific text strings and replace them all.

May not be possible to copy the actual file name into the <name> tag now that I think about it.... At least not without a batch file.

How many GPX files are you renaming?

Re: Bulk renaming of GPX routes to match filename

Posted: Sat Sep 26, 2020 9:52 am
by Spiney
They come in batches of 30 to 40 files and there could be quite a lot of batches in future to edit.

The GPX route names are sometimes but not always the same, so a global find and replace approach may not work?