VB Script For File Locking
Posted on 2009-02-20
I have a custom Vista application which watches a certain folder for PDFs to drop in. When it sees them it immediately moves a selected number (batch size) to another folder and opens a session of an OCR package to process the files. I have been using ABLE7 to move the files from a staging folder which receives FTPed files (down), then it moves them into the watched folder. The process works smoothly, but unfortunately ABLE7 sometimes just seems to get lost, forget, whatever. ABLE8 is no better, BTW. So I wrote a VB Script to move files from the staging folder to the watched folder. The problem is that the custom program grabs a file as soon as it hits the watched folder and moves it to the OCR batch folder, and the file is incomplete. When ABLE7 puts them into the watched folder,this does not happen, so I assume the file is locked until complete, then ABLE7 releases it and the custom SW can pick it up, but not before relased, therefore complete.
How can I prevent the custom SW (cannot be further modified at this point) from grabbing a file before it is complete and closed? Can I define an empty file as locked, then transfer in the data, then close the file and unlock it?