I have an application where every change in the database gets written into a simple text file. Basically a log. But this log contains EDI data that needs to be transfered into an FTP folder that is being fetched contantly by the EDI translating system.
So far the application works fine by writting the file in-house, checking whether the file exists or not in order to either append a new line or write a new file altogether and then using cfftp to copy it into the ftp folder. But, I would then have to manually copy the file and delete the file in-house in order for a new file to be written, otherwise, it'll continue to append new lines on the same file forever.
I'm thinking of 2 possible scenarios.
Using cfschedule to copy the file to the ftp and at the same time delete it locally, or being able to write the log lines automatically into the FTP the same way it does in-house.
Anyone have any ideas how to accomplish this?
My preference would be to do everything at once, as opposed to using a scheduled job.
If the intent is to always replace the existing file, that's easy enough with cffile. However, somehow you have to know whether the previous file has been picked up by your EDI system.
That's the thing. I already have it all working at the same time with cffile 'amend' and 'write', but the client wants me to drop the file every 15 or 20 minutes in his ftp folder.
Locally, checking the existence of the file and either amending writing it is a piece of cake but he wants the file not in my local server's folder but his via ftp.