Subject |
Re: Watching a folder |
From |
Andy Taylor <andy.taylor@cloud15.uk> |
Date |
Sun, 15 Jul 2018 06:25:45 -0400 |
Newsgroups |
dbase.getting-started |
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.
|
|