-

FILE_REMOVE

Type Function block
Description Deletes a file with a specific name.

Before deletion, the file to be deleted must be closed using the FILE_CLOSE function block.

Assign a STRING variable containing the name of the file to be deleted to the NAME input.

Activate the function block on a rising edge at the Execute input. Execution of the function block is complete when the Done output is set to 1. If an error occurred during execution, the value at the Error output = 1. ErrorID indicates the number of the cause of the error.
Notes
  • The data type of the file name must be STRING. The length of the file name must not exceed 80 characters including the path. User-defined strings are not allowed.

    With PLCnext Technology controllers, the default file path is /opt/plcnext. (If you are connected to the controller via SFTP or SSH, this is also the home directory.)
    If the file name does not contain any path information, the file is searched for/created in this directory. Any relative path in the name must also refer to this directory.

  • The status of the Done, Error, and ErrorID outputs is maintained until a falling edge is detected at the Execute input.
  • The error behavior of the function block may differ depending on the system on which the application with the function block call is running. If the function block is called for a file that is already open, the behavior may be as follows:
    • The file was not deleted. As expected, the Error output is set to TRUE and the ErrorID output issues error number 21.

      Or

    • The file was deleted (no error is reported). The file handle is still valid.
  • Function blocks have to be instantiated. The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used. The instance name must be unique within the POU.
Parameters Inputs

Execute

Name

Outputs

Done

Error

ErrorID