Subject Watching a folder
From Michael <michael@itntgroup.com.au>
Date Sun, 15 Jul 2018 05:08:04 -0400
Newsgroups dbase.getting-started

Hi Guys,

I need to check a folder to see if a .txt file has been written in the folder and is closed by another writing party.

I created a do while loop using file() to see if the file exists or not and then sleep a second to make sure the file has been written and closed as there is no file locking.

My concern is that if something goes wrong in writing the file by the  third party it could hang me in an endless loop.

Is there a better way to check a folder if a file has been written yet or not? and wait for it to be written without using a loop, for eg: using timer? to check every second or so?

Any thoughts/suggestions?

Michael.