@echo off REM GPS track copy and conversion script for Wintec WBT202 wenuti@20110220 REM Define preferences. Both must be set correctly ! Use double quotes if DSTDIR contains blanks set DSTDIR=C:\UserFiles\GPS\WBT202 set GPSBABEL=C:\Program Files\GPSBabel\GPSBabel.exe set SRCDIR=\WBT202 REM find out the drive letter of the device we're running on for %%i in (%CD%) do set j=%%~di set SRCDRV=%j:~0,1% REM Echo working parameters echo. echo WBT202.cmd: GPS track copy and conversion script for Wintec WBT202. wenuti@20110220 echo. echo Src drv: %SRCDRV%: echo Dst dir: %DSTDIR% echo GPSBabel: %GPSBABEL% echo Output: Nmea=.log GoogleEarth=.kml Gpx=.gpx OziExplorer=.plt OpenStreetMap=.osm echo. echo Ready. Press any key to start ... pause echo. REM loop directories on wbt202 drive (leave out SYS directory by using 2* mask) for /D %%I in (%SRCDRV%:%SRCDIR%\2*) do ( REM Directory already exists on destination - nothing to do if exist %DSTDIR%\%%~nI ( echo Checking for %DSTDIR%\%%~nI ... Exists - nothing to do ! REM Directory does not exist in destination - create it, copy .tes files, convert by call to GPSBabel ) else ( echo. echo Checking for %DSTDIR%\%%~nI ... NotFound - create ! echo. mkdir %DSTDIR%\%%~nI REM Loop over all .tes track files in source directory for %%J in (%SRCDRV%:\WBT202\%%~nI\*) do ( set F=%%~NJ set G=!F:~0,2!!F:~3,2!!F:~6,2! set SRC=%%J set DST=%DSTDIR%\%%~nI\WBT202-%%~nI!G! echo Copying !SRC! !DST!.tes ... copy !SRC! !DST!.tes 1>NUL echo Creating !DST!.[log,kml,gpx,plt,osm] "%GPSBABEL% " -i wintec_tes -f !DST!.tes -o nmea -F !DST!.log -o kml,points=1,line_width=3,lablels=1,trackdata=1 -F !DST!-l.kml -o kml,points=0,line_width=3,lablels=0,trackdata=0 -F !DST!-s.kml -o gpx -F !DST!.gpx -o ozi -F !DST!.plt -o osm,created_by=wenuti -F !DST!.osm echo. ) ) ) echo. echo. echo Done. Press any key to terminate ... pause