Jump to content

Poll Folders for new File


philaj

Recommended Posts

Hi All - hope someone has done this before.

I need to create a PHP script that detects the presence of a new file appearing into a folder, and process it.

This HAS to be supported by Windows IIS  (Have looked at FAM for Linux but can't use it).

I could do a loop with some sleep that checks the directory every x seconds - but this has been discounted by the client as either a) too resource hungry or b) not quick enough if there is a delay.

Add ons, extensions or even external 3rd party tools would all be acceptable.

Any ideas?

Phil

Link to comment
Share on other sites

On 6/4/2019 at 10:50 AM, philaj said:

I need to create a PHP script that detects the presence of a new file appearing into a folder, and process it.

This HAS to be supported by Windows IIS

IIS implements a Request-Response model.  It's not suited to long-running or cyclical processes.

However, PHP code doesn't only run inside IIS.  You can run it as a standalone program by "feeding" the PHP script file into the PHP executable.

php.exe -f myscript.php

That means that you can create a PHP script that does whatever you want it to, and schedule it to run whenever you need it to run using, say, Windows Task Scheduler.

 

Link to comment
Share on other sites

It's a kludge, but you could always keep a list of files in a database or flatfile and schedule a CRON to run a script that scans the directory for file names, then compare that to the saved list. You'd know if something had been added or removed, though it wouldn't be instant.

Link to comment
Share on other sites

This FTP process.  Could you possibly have an influence on those doing those transfers to use a script that you provide that would not only send you the file but send a message to a script that monitors an email address of yours and follows up by doing your processing?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.