Wednesday, April 4, 2012

Deleting file from PeopleCode

Solution 1) Using Java class:
/* Deleting previously created csv file */
&MAIL_FILES1 = "\\test-server\test-folder\test_File_To_Delete.CSV";

&javaFile = CreateJavaObject("java.io.File", &MAIL_FILES1);

If &javaFile.exists() Then
   rem &Filename.open();
   &javaFile.delete();
End-If;

Solution 2) 

&tmpfile1 = GetFile(“c:\temp\filetoDelete.txt”, “W”, “A”, %FilePath_Absolute);
&tmpfile1.Delete();

Thanks Srivani for the solution-1.

No comments:

Post a Comment