WaitForFile Context [WaitForFile file=FileName]Text[/WaitForFile]
Waits for a file to appear on disk, then performs the WebDNA.

To perform an action as soon as a file appears on disk, put WebDNA inside of a [WaitForFile] context. The server waits until the specified file appears on disk, then executes the WebDNA inside the context.

Note: WaitForFile will wait a specified number of seconds (default 30) until the file appears. The template will not finish executing and the HTML will not be returned to the visiting browser until the WaitForFile finishes.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[WaitForFile file=ICVer001.ans]
Some WebDNA to parse the ICVerify answer file format and do something important with it

You can write WebDNA that learns if the WaitForFile timed out:

[WaitForFile file=FileToWaitFor.txt]
Some WebDNA to execute if the file is found
[ShowIf [succeeded]=T] File was found! [/ShowIf]
[ShowIf [succeeded]=F] File was not found! [/ShowIf]

The value of [succeeded] becomes either T or F, depending on whether or not the [WaitForFile] succeeded in finding the file on disk before the timeout expired.

Parameter Description
(Required) Path to the file that will appear in the future. If the file exists on disk already, there is no waiting.
(Optional) Number of seconds to wait before cancelling the operation. No WebDNA inside the [WaitForFile] context will be executed. Defaults to 30 seconds if not specified.

User Contributed Notes

Copyright © 2008 WebDNA Software Corporation, Inc.