Subject Re: Watching a folder
From Michael <michael@itntgroup.com.au>
Date Sun, 15 Jul 2018 09:35:12 -0400
Newsgroups dbase.getting-started

Andy,

how does _app.executedmessages() work? Do you have some sample code? How can I make it execute a function when a file is found?

Cheers,

Michael.

Andy Taylor Wrote:

> Michael,
>
> Sleep will have dBASE continually watching the clock and doing not a lot else.
> The timer is the best way to do what you want.
>
> UNLESS.... you are only expecting delays of a few seconds in which case you could use a counted loop
>  of up to say 10,000 with file(*.txt) and_app.executemessages() being called in the loop.
>
> Andy
>
> > 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.
>