DeleteFile (String filePath)

Name

DeleteFile

Syntax

DeleteFile (String filePath)

Purpose

To delete a file if it exists.

Description

Deletes a file if exists.

Return Type

Void

Parameter

filePath [System.String] – Full path of the file.

Example

In this example, we are passing the required parameter to the function transformation object using a Variables object. We will be deleting a “Test.txt” source file which exists within a folder.

Where,

filePath = C:\Users\Kanwal.Azim\OneDrive - Astera Software\Desktop\Functions Documentation\Files\DeleteFile\Test.txt

Right-click on the function transformation object and select Preview Output. While the Data Preview will not generate an output, the existing file within the specified location will be deleted.