ITP/Server Script

The following ITP/Server script generates an XML listing of the directory that is specified in its Dir parameter.

# ITP/Server script ListDir

Parameter Text Version;
Parameter Text Dir;

Const Text List = "list.xml"[TempDir,];
Temporary File(List);

WriteFile File(List) Message("<items>");
Var Text File;
ForEach File Folder Dir Do
	WriteFile File(List) Message("<item>");
	WriteFile File(List) Message("<![CDATA[" + File + "]]>");
	WriteFile File(List) Message("</item>");
Od;
WriteFile File(List) Message("</items>");

SendFile Dest("info") Src(List);

Notice that this script specifies an additional "Version" parameter. All ServerCall invocations of type "online" implicitly get this extra parameter. It specifies the version of the low-level protocol that ITP/OnLine uses. Currently, it is "1", and there is no need to take it into account2.