Bulk conversion of files in Windows

Dimitri Tundra contributes this tidbit:

To convert all trace files in a directory from one format to another, you just need to build a batch file that does t hem one by one. in that directory create a text file with any name and a *.bat extension. Open it with the Notepad text editor.

Put the following command in that file:

FOR %%i IN (*.<extension>) DO <path to GPSBabel>\gpsbabel <switches> -i <input format> -f %%i -o <output format> -F %%~Ni<new file ending>

In here, angle brackets and their contents should be substituted with appropriate information. Save the file and double click on it to run it. That's all.


Create a file TpoToGpxConv.bat. Open it in Notepad. Put the following line in it, save and run it in the directory where the files that need to be converted reside:

FOR %%i IN (*.tpo) DO C:\_1\AB_Hiking\TopoPrograms\GPSBabel_Ver1_3_4\gpsbabel -t -w -i tpo3 -f %%i -o gpx -F %%~Ni_tpo.gpx

I am converting all *.tpo files to the *.gpx. GPSBabel in my computer is located in C:\_1\AB_Hiking\TopoPrograms\GPSBabel_Ver1_3_4\ directory. The -t -w switches allow me to convert waypoints and trace points, tpo3 is the latest *.tpo format which I am converting from. gpx is the format I am converting to. Finally, the last statement says take the file name, strip it off the extension (~N), and add the following ending to it: _tpo.gpx. So if I had a group of files *.tpo, after running this batch file I get corresponding files *_tpo.gpx, which I can open with any trace editing program.