The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.
ERASE Method (File)
Deletes a file.
Type: Text or code
The name of the file that you want to delete, including the path. When you enter the path, consider these shortcuts:
You can omit the drive designation if the file is located on the current drive.
You can omit the full path if the file is located in the current directory.
You can enter only the subdirectory name if the file is located in a subdirectory of the current directory
Property Value/Return Value
Specifies whether the file was deleted.
true if the file was deleted; otherwise, false.
If you omit this optional return value and the file is not deleted, a run-time error occurs. If you include the return value, you must handle any errors.
If the user who runs this method does not have the required permission to delete the file or if the file is read-only, then the file is not deleted.
The following example deletes the file that is named C:\TestFolder\NewTestFile.txt.This example assumes that you have created the file on your computer.