Technical References - [waitforfile]

The server waits until the file appears on disk

numero = 190
interpreted = N
texte = WAIT FOR FILE [waitforfile path]Text and code[/WaitForFile] The server waits until the specified file appears on disk, then executes the WebDNA inside the context. 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.

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
[waitforfile file=ICVer001.ans]Some WebDNA to parse the ICVerify answer file format and do something important with it[/WaitForFile]
You can write WebDNA that learns if the WaitForFile timed out:
[text]succeeded=F[/text][waitforfile file=FileToWaitFor.txt]Some WebDNA to execute if the file is found[text]succeeded=T[/text][/waitforfile][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.
ParameterDescription
file
(Required) Path to the file that will appear in the future. If the file exists on disk already, there is no waiting.
timeout(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.
See also [writefile], [appendfile], [createfolder], [copyfile], [copyfolder], [movefile], [deletefile] and [deletefolder] WAIT FOR FILE
[waitforfile path]Text and code[/WaitForFile]
The server waits until the specified file appears on disk, then executes the WebDNA inside the context.

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.

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
[waitforfile file=ICVer001.ans]
Some WebDNA to parse the ICVerify answer file format and do something important with it
[/WaitForFile]


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

[text]succeeded=F[/text]
[waitforfile file=FileToWaitFor.txt]
Some WebDNA to execute if the file is found
[text]succeeded=T[/text]
[/waitforfile]
[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.

ParameterDescription
file
(Required) Path to the file that will appear in the future. If the file exists on disk already, there is no waiting.
timeout(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.


See also [writefile], [appendfile], [createfolder], [copyfile], [copyfolder], [movefile], [deletefile] and [deletefolder]

DOWNLOAD WEBDNA NOW!

Top Articles:

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...

F.A.Q

A compilation of some user's questions...

Tips and Tricks

A list of user-submitted tips ...

[biotype]

BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

WebDNA Libraries

A list of available libraries for WebDNA...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Related Readings:

[countwords]

The number displayed is the number of words inside the context...

[sendmail]

There is hardly a website that doesn't at some point need to send an email...

[uppercase]

Changes all lower case letters to upper case...

[version]

...

[return]

Explicitly identify what text is returned from a function call...

[waitforfile]

The server waits until the file appears on disk...