home Mail List
Info
Info
Meetings
Goals
Upcoming
Projects
FAQ
Security
Links

[Date Prev][Date Next] [Chronological] [Thread] [Top]

[lists] [NMLUG] backup storage trade



Cool.  here is a script i wrote that does exactly that.

#!/usr/bin/perl
# Kelly Wilson, kwilson@swcp.com
#
# bulkimageemail.pl
# Send all jpg images in a specified directory to an email recipient.
# 
-----------------------------------------------------------------------------
$stime = time();
$imagedir = '/home/kelly/bulkpics/';

$towho = $ARGV[0];
unless($towho) { die "enter a destination email address \n"; }
$fromwho = 'kwilson@swcp.com';   ###

system('cls');
use MIME::Lite;
MIME::Lite->send('smtp', "mail.swcp.com", Timeout=>30);

opendir(DIR, $imagedir) or die "Cannot open $imagedir \n $! \n";
@imagefiles = grep /jpg/i, readdir(DIR);
closedir(DIR);
@pics = sort @imagefiles;
$piccount = @pics;

print "$piccount pictures to send to $towho \n\n";

foreach $pic(@pics) {
     $cnt++;
     my $picname = "$imagedir"."$pic";
     my $msg = MIME::Lite->new(
         From       =>"$fromwho",
         To         =>"$towho",
         Subject    =>"Digital pic $pic",
         Type       =>'image/jpeg',
         Encoding   =>'base64',
         Path       =>"$picname"
         );

	print "Sending picnum $cnt name $picname to $towho \n";

     $msg->send;

}#end foreach $pic
$etime = time();
$ttime = $etime - $stime;
print "\n\n","-" x80,"\n",
       "Sent $cnt pics sent to $towho in $ttime seconds \n\n";
exit();
  --

Yeah, it could be prettier or fancier but I use it all the time to 
shotgun pics to friends and family.

--
Kelly



bg wrote:
> This email got me thinking... again. :)
> 
> I have about 3000 photos I've taken with my digital camera. They're all
> numbered from DCP0001 to DCP3120, and are all roughly 1024*768 pixels
> apiece. I'd like to find (or write) a script that sends each - in
> individual emails, with the file name as the email's subject - to my
> gmail and yahoo accounts. Since the storage required is >1GB, I wouldn't
> be able to send all of them to one account.
> 
> I'm not sure Gmail's bandwidth would allow for this, but why offer 1GB
> of storage if they can't handle it?
> 
> Any idea how to do this?
> 
> _______________________________________________
> NMLUG mailing list
> NMLUG@nmlug.org
> http://www.nmlug.org/mailman/listinfo/nmlug
> 
> 



Please send sugestions and comments to webmaster@nmlug.org.
Valid XHTML 1.1! Valid CSS! Powered by Debian Powered by Apache