#!/usr/bin/perl
#my dir =pwd
#my piclist=`ls *jpg`

my $dir='/home/e3/Media Gallery/Camera Pictures';
die "$dir: $!" unless -d $dir;
chdir $dir or die $!;

my $outfile='.pics.pl.';

my $i=0;
for my $f (`ls -a ./.*pics.pl*`) {
  $i++;
}
$outfile.=$i; #numbered backups yo

open my $O, ">:encoding(utf8)", $outfile;

my  $header=sprintf "<html><title>pics@".$dir."</title><head></head><body>";
printf "%s\n", $header;

foreach my $file (`ls`) {
  chomp $file;
  next if !-f $file;

  my $thisrow=sprintf "<img src=\"%s/$s/%s\">%s</img>", $dom, $dir, $file, $file;
  my $thatrow=sprintf "<img src=\"%s/$s/%s\">%s</img>", $dom, $dir, $file, $file;
  printf "%s\n", $row;
}

my $footer=sprintf "</body></html>";
printf "%s\n", $footer;


#my $cmd=sprintf "scp -p %s sirdavec@sirdave.com:src", $outfile;

