Re: Gpsbabel - how to do all files in a directory

From: John Navas (spamfilter0_at_navasgroup.com)
Date: 08/26/04


Date: Thu, 26 Aug 2004 17:02:56 GMT


[POSTED TO sci.geo.satellite-nav - REPLY ON USENET PLEASE]

gpsbabel doesn't seem to support filename wildcards, so you have to do this
programmatically; e.g., with a script or (with Windows NT/2000/XP command
extensions) batch file. In the latter case, the following example text would
be in a file with a .CMD extension:

   FOR %%X IN (\tmp\*.mps) DO gpsbabel -i mapsource -o text %%X %%~dpnX.txt

The "\tmp\*.mps" creates a list of all files in the \tmp directory that have
".mps" as the extension. ("*" is a 'wildcard' that matches any characters.)
The "FOR" command then processes that list, one file at a time, each time
substituting one of the filenames for "%%X". The "%%~dpnX.txt" is used to
build a corresponding output filename with the same drive-path-name ("dpn"
modifier on "X") plus ".txt" as the extension. Hence if \tmp contained
FILE1.MPS, FILE2.MPS, and FILE3.MPS, "FOR" would execute the following
commands:

   gpsbabel -i mapsource -o text \tmp\FILE1.MPS \tmp\FILE1.TXT
   gpsbabel -i mapsource -o text \tmp\FILE2.MPS \tmp\FILE2.TXT
   gpsbabel -i mapsource -o text \tmp\FILE3.MPS \tmp\FILE3.TXT

Hope that helps.

Best regards,
John Navas

In <DOcXc.517073$Gx4.105763@bgtnsc04-news.ops.worldnet.att.net> on Thu, 26 Aug
2004 03:29:39 GMT, "Tom H." <tom_reader@att.nospam*.net> wrote:

>I would like to convert all files in a directory and am having trouble
>interpreting how to get gpsbabel to convert a few Mapsource files to text
>files. The readme has the following statement:
>
>gpsbabel -i geo -f /tmp/geocaching.loc -o gpx -F /tmp/geocaching.gpx
>tells it to read the first file in geocaching.com format and create
> a new file in GPX format.
>
>I tried doing this as shown below
>
>C:\Program Files\gpsbabel>gpsbabel -i mapsource -f /tmp/mapsource.mps -o -F
>/tmp
>/text.txt
>MAPSOURCE cannot open '/tmp/mapsource.mps' for read. Error was 'No such
>file or
> directory'.
>
>I am not used to command line instructions, so I am probably interpreting
>the example command improperly. Can someone give me some help with more
>details on how to do this.
>
>TIA,
>Tom



Relevant Pages

  • Re: Un-erasable folder
    ... >>> enclose the entire filename (including the path if you are not in its ... >>> parent directory). ... >> extension, so the use of one or more periods in a filename can get very ... Like the former deltree command. ...
    (microsoft.public.windows.file_system)
  • Re: How to add a command to right click in Windows Explorer
    ... I tried this, and I did see a command window pop up, but it did not compile. ... I think it needs the full filename and extension passed to it. ... Click the File Types tab. ...
    (microsoft.public.windowsxp.general)
  • how to test extension of file
    ... i just wanted to know whether the "test" command has ... an option for testing the extension of file. ... i wanted to know if $x is of the form *.swp ... where $x has the filename. ...
    (comp.unix.shell)
  • Re: Unable to delete folder
    ... Before the Long File Names should be a column showing the SFN (Short File Name, also known as the 8.3 filename) for each file whose LFN does not qualify as ... Then just use the Del command with the SFN: del endtro~1, for example - but the actual SFN might be something unexpected! ... Even with LFNs, each file has only a single extension, although many appear to have multiple extensions. ... Either Move it into another folder or Move everything except this file out of this folder. ...
    (microsoft.public.windows.file_system)
  • Re: Using an Excel sheet for batch delete
    ... but wondered what the routine would make of the situation where the input to both source and destination popups was identical. ... When I used it on filenames with no extension, ... Does the filename contain any dots. ... If SourcePath = "" Then Exit Sub ...
    (microsoft.public.excel.worksheet.functions)