Deletes a file.
- Target file is the path of the file to delete. See Creating file paths.
|FileMaker Data API||No|
|Custom Web Publishing||Yes|
Originated in version
Deletes the change.log file.
Delete File [ Target file: "change.log" ]
Deletes the change.log file. If the file doesn't exist or another error occurs, the script displays a custom error message.
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." ]
Set Variable [ $errorMessage ; Value: "Error: " & Get ( LastError ) & ¶ & "The file was not deleted." ]
Show Custom Dialog [ $errorMessage ]
Exit Script [ Text Result: ]
Show Custom Dialog [ "The file was deleted." ]