#!/usr/local/bin/perl @dir=readpipe("dir images\\*.jpg /O:N /B"); $files=@dir; for($inc=0;$inc<$files;++$inc) { $line = @dir[$inc]; chomp($line); ($name,$ext)=split('\.',$line); if ($ext eq "jpg") { $line =~ s/.jpg//; (@temp)=split('\_',$line); $year=substr @temp[2],7,4; $date=substr @temp[2],3,4; $time=substr @temp[2],11,6; $newname=$year.$date."\_".$time; open (TEXT, "images\\$line.txt"); @text=; $linet=@text[5]; chomp($linet); (@linet)=split('\ ',$linet); $north=@linet[3]; $west=@linet[4]; $east=@linet[8]; $linet=@text[6]; chomp($linet); (@linet)=split('\ ',$linet); $south=@linet[3]; close (TEXT); open (OUT, ">$newname.kml"); print OUT" $newname images/$line.jpg $north $south $east $west \n"; close (OUT); } }