We have an interface file that we want to delete for security reasons once we have processed the file. But, deleting it from the Application Engine was not as straight-forward as I would have thought.
This does not work:
RemoveDirectory("c:\temp\mytextfile.txt", %FilePath_Absolute);
So, Java to the rescue — this does:
Local JavaObject &javaFile; &javaFile = CreateJavaObject("java.io.File", "c:\temp\mytextfile.txt"); &javaFile.delete();
Update (8/20/2014):
Back when I wrote this post, I missed seeing the .Delete() method of the File API object. That would be the better way to make this work. Here’s an example:
Local File &file; &file = GetFile("c:\temp\mytextfile.txt", "W", "A", %FilePath_Absolute); &file.Delete();
(Thanks Tim and Andrew for pointing this out.)
Resources
- JavaDocs for File
- JavaDocs for the delete() method
- RemoveDirectory function (update 12/7/2012: linked to Oracle’s PeopleBooks)