Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute on file creation

Status
Not open for further replies.

DugsDMan

Programmer
Mar 19, 2002
85
US
Is there a way for a CF module to be executed upon a file being created on a server?? I have a mainframe job that creates a bill, then passes along information to a load job, also on the mainframe. The problem is that I don't know PL/I well enough to have enough power to process the file the way I would like. I was able to piece together a program to load the information (by parsing it with SQL). If I could use a CF module, I could EASILY parse the file looking for certains words, and updating the database accordingly. I can set the mainframe program to FTP the file where ever I like, but still have to process it.

I understand that items can be scheduled, but this needs to be done within a minute or two of the jobs completion and I know the webservices group will not allow me to schedule something to run that often.

Any ideas???

Thanks!
 
There really isn't a way in ColdFusion itself to build an efficient system to watch a directory for changes (like you said... you could certainly build a scheduled task that fires every minute or so and checks the directory contents against a previous snapshot... but it'd be terribly inefficient).

But you could certainly build a trigger in a language/tool that is more suited to the task... if you're running on UNIX, there's a way to do it in shell script that's only a line or two of code, if I remember. Windows would be another issue.

At any rate... you could then have this trigger call your ColdFusion template either via a URL if whatever trigger solution you come up with supports HTTP, or via calling the template on the commandline (as a parameter of the cfexec executable). Then the CFM template can do all the parsing and database inserts you need.


-Carl
 
I've found a way to write a prog in VB that will place a listen for the file creation on the server. It's the FindFirstChangeNotification API. Now that I've found a way to do this, of course, things have changed again. I'm still going to try to look into this more, just for my own information though. Who knows, this will probably change back again anyway :)

Thanks for the info though!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top