Move and Delete files using PeopleCode
We can use the below java object and code to move or deleting files from some location.
Moving file:
Deleting file:
Moving file:
Local JavaObject &source = CreateJavaObject("java.io.File", "/source/file.txt"); Local JavaObject &target = CreateJavaObject("java.io.File", "/target/file.txt"); &source.renameTo(&target);
Deleting file:
Local JavaObject &DelLoc = CreateJavaObject("java.io.File", "/source/file.txt");
&DelLoc.delete();
Alternate code for deleting file:
&tmpfile = GetFile(“c:\temp\file.txt”, “W”, “A”, %FilePath_Absolute); &tmpfile.Delete();
No comments:
Post a Comment