Bill O'Reilly <[EMAIL PROTECTED]> wrote: > > I am trying to setup a script on a linux (RedHat 7.3) box that > when someone copies a file to a particular folder it would trigger > an email being sent to a user. There are multiple folders I would > like to add this script to that all I would need to do would be to > change the subject line of the email. > > Does anyone have any suggestions on where I can look to write > something like this or ideas on writing it? Is this possible? >
The tricky bit is monitoring the directory. You should be able to use FAM, which is pretty slick: http://search.cpan.org/author/JGLICK/SGI-FAM-1.002/lib/SGI/FAM.pm http://oss.sgi.com/projects/fam/links.html But normally, you just poll: #!/usr/bin/perl use strict; use warnings; sub difference { my %diff; @diff{ @{$_[0]} } = (); delete @diff{ @{$_[1]} }; sort keys %diff; } my $dirname = shift or die "usage: $0 <directory>"; opendir DIR, $dirname or die "opendir $dirname: $!"; my @old = readdir DIR; while (sleep 1) { rewinddir DIR or die "rewinddir: $!"; my @current = readdir DIR; print "$_\n" for difference \@current, \@old; @old = @current; } And there are lots of modules for sending mail on CPAN. Maybe try try Mail::Mailer or Mail::Sender. -- Steve perldoc -qa.j | perl -lpe '($_)=m("(.*)")' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]