RE: [PBML] CGI script that will SENDMAIL when file added to folder.
- guest user <docdoo99@...> replied:
: This is why I thought a basic (hehe) script that
: uses "sendmail" to email me when file is added to
: specified directory. This way nothing effects
: their current setup.
I can think of two paths. Write a script that
compares an old directory listing with a current
directory listing and reports changes. Then
cronjob the script (I'm assuming your using unix).
I don't see how you'd get a user IP or the
original file name but you would have the new
The second idea would be to use signal
processing to alert a perl program that a new
file has been uploaded. I have no idea how to do
this. Perhaps a kind unix person from the list can
tell us if it is possible to use signals in this
way. This approach would be very OS specific.
Either of these two approaches does not
involve programming the CGI. There is no need to
communicate with a browser to send email via
(A third approach would be to rewrite the
script you're "not allowed" to rewrite. Of
course this depends on why you're not allowed
to edit it. Think of it as Civil Disobedience,
but don't lose the job over it.)
Charles K. Clarkson
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
- No, it's not a big job if there are only 100 files.
You don't need to compare the content of the files but only their names.
You just need to compare an array with 100 file names taken from a text file
that keeps the old file names with the current list of file names taken from
But it would be much more simple just to add a few lines of code to the
script used for uploading.
Teddy's Center: http://teddy.fcc.ro/
----- Original Message -----
Sent: Friday, January 03, 2003 4:29 PM
Subject: Re: [PBML] CGI script that will SENDMAIL when file added to folder.
--- In firstname.lastname@example.org, "Octavian Rasnita"
> Make a CGI script which is executed by cron or which is executed
> someone will visit a certain web page from that site.
> Put it to create a list of files from that directory, and each
> executed, let it compare it with the list of the files from that
This would create exessive CPU usage on the server. Especially since
there are 100's of other files to compare against (many large). Its
kind of like using a drill press to punch a hole in paper :) But
your right, it can be made to work... In the past, I've only used
cron to send me logs (error & access) every 3:am.
There must be a cleaner (simpler) way of doing this. Maybe its time
to re-code the whole entire thing from scratch :-O
Unsubscribing info is here:
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>A third approach would be to rewrite the script you're "not===========
>allowed" to rewrite. Of course this depends on why you're not
>allowed to edit it. Think of it as Civil Disobedience, but don't
>lose the job over it.
They don't want it changed because the way it stands now...it ain't
But to be quite honest with you, this automated "sendmail" script is
to speed up the work that I need to do. It my gain, not theirs. I
could sneak the code into the original, but that is not my style :-)
my $COMMENT = 'my search continues'; # Sigh