#!/opt/local/bin/perl
use strict;
$|++;
my $HOME = glob "~";
my $OUTDIR = "$HOME/Pictures/From Memory Card";
my @now = gmtime;
my $stamp = sprintf "%04d-%02d-%02d %02d:%02d:%02d",
$now[5]+1900,
$now[4]+1,
@now[3,2,1,0];
my $out = "$OUTDIR/$stamp.gpx";
my @files = glob "/Volumes/NO\\ NAME/WBT202/20*/*.TES";
# print "$_\n" for @files;
system
qw(gpsbabel),
qw(-i wintec_tes),
(map {; "-f", $_ } @files),
qw(-o gpx),
qw(-F), $out,
;
if ($?) {
die "exit status is $?";
} else {
# warn "unlink @files...\n";
for (@files) {
unlink $_ or warn "cannot unlink $_: $!\n";
}
system "open", $OUTDIR;
}