Salesforce

How Do I Delete a Disk File? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Delete a Disk File? (Magic xpa 3.x)

Sometimes you will want to delete disk files. After you create temporary files, for instance, you will want to clean them up out of the temporary directory. Or, if you are recreating a file, you may want to be certain that the old one is gone before starting the new process.

It is always better to use the Magic xpa functions rather than using an exit to the operating system. Using an exit to the operating system is very dependent on the version of the operating system and how the user is set up; the Magic xpa functions are far more reliable. Also, the Magic xpa functions allow you to check return codes more easily.

FileDelete()

You can delete a file on disk using the FileDelete() function. The syntax is:

FileDelete(File Name)

Where File Name is the file you want to delete. It gives a return code of TRUE if the file was successfully deleted.

Note: The return code will be false if the file wasn’t deleted. It will also be false if there was no file to delete in the first place. Therefore, it’s a good idea to use this in conjunction with FileExist(), so you know the file has been deleted.

See also

The FileExist() description in How Do I Check if a File Exists on Disk?

The Online and Rich Client Samples projects (program EL15, REL15 and REL15b)

Reference
Attachment 
Attachment