#!/usr/bin/perl
#This script sends over the last small image taken (sv???.jpg)

#Packages to use
use Cwd;

#first we have some constants
$start = cwd();
$bigjpg_dir = "vjpg";
$smalljpg_dir = "svjpg";
$smallppm_dir = "svppm";
$remote_IP = "128.100.10.200";
$login_name = "dusting2";
$password = "dusting2";
$remote_dest_dir = "";

# see what highest number yet used is:
$pictnum=100;
for ($counter=100;$counter<999;$counter++){
  if (-e "$bigjpg_dir/v$counter.jpg") {
	$pictnum = $counter;
  }
}
if ($#ARGV == 0) {$pictnum = $ARGV[0];}
printf("Start pict sv%d.jpg\n",$pictnum);
    #Now we send it over
    `rm ~/.netrc`;
    `touch ~/.netrc`;
    `echo "machine $remote_IP" >> ~/.netrc`;
    `echo "login $login_name" >> ~/.netrc`;
    `echo "password $password" >> ~/.netrc`;
    `echo "macdef init" >> ~/.netrc`;
    `echo "bin" >> ~/.netrc`;
    `echo "put $start/trowel_out.jpg sc$pictnum.jpg" >> ~/.netrc`;
    `echo "bye" >> ~/.netrc`;
    `echo >> ~/.netrc`;
    #won't work unless only you can read/execute it
    `chmod 600 ~/.netrc`;
    `ftp $remote_IP`;
    printf("Sent image\n");

    `rm ~/.netrc`;
