# 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. |

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FWlqcd5tYGB0GnVrNXScc%2F0.png?alt=media)

**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*

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FTZ2AeYA5JEH6pM4NeUHs%2F1.png?alt=media)

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.
