WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: archimede on July 01, 2022, 09:08:43 AM

Title: Wait for a file existence
Post by: archimede on July 01, 2022, 09:08:43 AM
Hallo
I need to wait for a file existence.
I tested FileExist(...) like
While !FileExist("File.txt")
EndWhile
it works, but it is hard because continue to unuseful cycle.
Is it possible to stop the program flux until a file will exist?
Is it possible to define a generic name ( like "*t?.txt" ), not only a specific name?

Thank you very much
Title: Re: Wait for a file existence
Post by: JTaylor on July 01, 2022, 09:51:27 AM
Can you restate things a bit.  Not sure what you mean by

it works, but it is hard because continue to unuseful cycle.
Is it possible to stop the program flux until a file will exist?


If you mean the While loop halting further activity being the issue and you want to do other stuff, if you have a dynamic dialog in use you could use the Timer event.


Jim
Title: Re: Wait for a file existence
Post by: td on July 01, 2022, 10:09:00 AM
1. FileExist does not support file name masks.

2. Use the TimeDelay function to suspend a script for some period of time in between file existence checks.

3. If you wish to check for the existence of one or more files by file name masks use FileItemize or a similar function and see 2 above.
Title: Re: Wait for a file existence
Post by: ChuckC on July 01, 2022, 11:56:30 AM
Tech Support DB articles of interest:

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/_Third~Party~Extenders/Watcher+Watcher~Extender~.txt (https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WIL~Extenders/_Third~Party~Extenders/Watcher+Watcher~Extender~.txt)

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/WMI+Directory~Watcher.txt (https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/WMI+Directory~Watcher.txt)