You are viewing the RapidMiner Studio documentation for version 9.9 - Check here for latest version
Delete File (RapidMiner Studio Core)
Synopsis
This operator deletes a file at the specified location.Description
The Delete File operator deletes the selected file if possible otherwise an error message is shown. You can also specify that an error message should be shown if the file that should be deleted does not exist.
Input
- through (Data Table)
It is not compulsory to connect any object with this port. Any object connected at this port is delivered without any modifications to the output port. This operator can have multiple inputs. When one input is connected, another through input port becomes available which is ready to accept another input (if any). The order of inputs remains the same. The object supplied at the first through input port of the Delete File operator is available at the first through output port.
Output
- through (Data Table)
The objects that were given as input are passed without changing to the output through this port. It is not compulsory to attach this port to any other port, the file is deleted even if this port is left without connections. The Delete File operator can have multiple outputs. When one output is connected, another through output port becomes available which is ready to deliver another output (if any). The order of outputs remains the same. The object delivered at the first through input port of the Delete File operator is delivered at the first through output port
Parameters
- fileThe file that should be deleted is specified through this parameter. Range: file
- fail_if_missingDetermines whether an exception should be generated if the file is missing, e. g. because it already got deleted in the last run. If set to false nothing happens if this error occurs. Range: boolean
Tutorial Processes
Writing the Labor-Negotiations data set into an Excel file and deleting it
This Example Process shows how the Delete File operator can be used to delete a specified file. For this Example Process you first need a file to delete. An Excel file is created by loading the 'Labor-Negotiations' data set with the Retrieve operator and writing it into an Excel file with the Write Excel operator. The file is saved as '%{tempdir}/Labor data set.xls' if this file does not already exist. A breakpoint is inserted so you can have a look at the Excel file in your D drive. For further understanding of this operator please read the description of the Write Excel operator.
The Delete File operator is inserted after Write Excel. The file parameter is set to '%{tempdir}/Labor data set.xls' and the fail if missing parameter to true. Run the process and the file in the temp folder will be deleted. If you delete the Retrieve and the Write Excel operator and run the process again an error message will be shown telling you that the file could not be deleted as it does not exist.