Checking for a new file & importing into MySQL


I want our company employees to be able to update our website with special formated emails. My IT guy has made a perl script to parse the email to a text file formatted the way I want.

I want him to dump the txt file into a directory, that is being watched. When a new file is put there, I want something to pass the name onto my PHP script, so it can run, and import the file into mySQL. My PHP script works if I tell it what the name of the file is, but I have to execute the script myself.

I am not sure if I can use PHP to monitor the folder for new files, or if I need to use a crontab, or what?

Any ideas?


I am not sure if PHP has any sort of triggering mechanism. If you have the lynx browser installed you could run something like this every couple of minutes to hit your PHP script:


Your script would then look in the folder and do its magic. You can probably have your IT guy build similar functionality into the Perl script as well...