|
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_2 function
block.Assign a STRING variable containing the name of the file to be deleted to the NAME input.As soon as the REQ input is set to TRUE, the inputs are validated. The REQ input must remain set to TRUE, until the file delete operation is completed (regardless of whether the operation succeeded or failed). The BUSY output is TRUE while the operation is being executed asynchronously on a Service Thread. Execution of the function block is complete when the DONE output is set to TRUE.If an error occurred during execution, ERROR is set to TRUE, and the error code can be read from the STATUS output. |
|
Notes
|
- The file to be removed must not be write-protected.
- 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. Because this folder is write-protected on all secure-by-default controllers (for example, Virtual PLCnext Control, AXC F 1252 controller), file names without path are not recommended.As of firmware version 2025.0, both device classes (PLCnext Technology controllers and secure-by-default controllers) contain a folder /opt/plcnext/custom to which the firmware has write access.For a complete list of secure-by-default controllers, refer to the PLCnext Info Center.
- The status of the DONE, BUSY, ERROR, and STATUS outputs are maintained as long as REQ is TRUE.
- When the function block is used as global function block, it is not thread-safe. In this case, make sure to prevent concurrent calls (e.g., by using the MUTEX function block).
- 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
REQ
| Data type: | BOOL |
| Description: | As soon as the input is set to TRUE, the inputs are validated. Must remain set to TRUE until the file operation is complete. Once the operation is fully complete, the input must be set to FALSE. Subsequently, the outputs are reset to their default values. |
NAME
| Data type: | STRING |
| Description: | Name of the file to be deleted including path.See the "Notes" section above for more information on file directories. |
Outputs
DONE
| Data type: | BOOL |
| Description: | Set to TRUE when the operation has been completed successfully. |
BUSY
| Data type: | BOOL |
| Description: |
| 0 | No operation executed on Service Thread. |
| 1 | The file remove operation is currently being executed asynchronously on Service Thread. |
|
ERROR
| Data type: | BOOL |
| Description: |
| 0 | No error occurred during deleting the file. |
| 1 | An error occurred during deleting the file. The error code can be read from the STATUS output. |
|
STATUS
| Data type: | DWORD |
| Description: | Indicates the status of the operation:
| 0 | No errors during execution of the file operation. |
| 1 | The execution of the file operation has failed. |
| 11 | An invalid file name was specified. |
|
|