Delete File

Deletes a file.

Options 

Compatibility 

Product Supported
FileMaker Pro Yes
FileMaker Go Yes
FileMaker WebDirect No
FileMaker Server Yes
FileMaker Cloud Yes
FileMaker Data API No
Custom Web Publishing Yes

Originated in version 

18.0

Example 1 

Deletes the change.log file.

Copy
Delete File [ Target file: "change.log" ]

Example 2 

Deletes the change.log file. If the file doesn't exist or another error occurs, the script displays a custom error message.

Copy
Set Error Capture [ On ]
Set Variable [ $file ; Value: "change.log" ]
Delete File [ Target file: $file ]
If [ Get ( LastError ) > 0 ]
    If [ Get ( LastError ) = 100 ]
        Set Variable [ $errorMessage ; Value: "The file doesn't exist." ]
    Else
        Set Variable [ $errorMessage ; Value: "Error: " & Get ( LastError ) & ΒΆ & "The file was not deleted." ]
    End If
    Show Custom Dialog [ $errorMessage ]
    Exit Script [ Text Result: ]
End If
Show Custom Dialog [ "The file was deleted." ]