UNLINK

Concept Link IconSee also

Delete a file.

WebVue support - Yes.

Syntax

IntVal = UNLINK(Filename);

Return type: INTEGER.

Argument

Meaning

Filename

The name of the file to be deleted. Type STR.
If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the referenced file is on that computer.

Execution

The file must be closed before it can be deleted. ACL as defined at the filesystem level apply.

The argument Filename can be:

  • A simple file name such as "MyFile.txt", in which case the file will be looked up in the project's TP directory (default base folder)
  • A relative file name such as "..\\..\\DirectoryXYZ\\MyFile.txt", in which case the file will be looked up in a directory relative to the project's TP directory
  • An absolute file name such as "D:\\DirectoryXYZ\\MyFile.txt" or "\\\\FileServerXYZ\\DirectoryXYZ\\MyFile.txt"

Note that '\' being an escape character, it must be doubled ('\\') in file and folder references.

Return:

1 if successful, else 0.

Example

'For this. there must be a file "file1.txt" in

' the TP folder of your project

SUB Main()

IF (UNLINK("file1.txt")==1) THEN

  PRINT ("file1.txt has been deleted");

END IF

END SUB