This page has moved. Please update your links:http://psst0101.digitaleagle.net/2008/10/28/deleting-files-from-peoplecode
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();
November 5, 2008 at 9:05 am
Thanks, very nice. Something different, instead of using the delete method of the file object.
February 8, 2009 at 10:56 pm
I tried the code, that you mentioned but somehow I am getting Java class not instantiated error. Is there some setup needed for this?
You have quite good tips and I saw some more at http://www.itwisesolutions.com/PsftTips.html website.
thnks
Larry
March 28, 2009 at 6:24 pm
Excellent solution. It worked great for me. I used EXEC to delete a file and I was not able to. Not sure why it was not working but Java option worked well..
Thanks a lot digitaleagle.
July 10, 2009 at 4:17 pm
Thanks for the tip. I’ve used the following and it work well to.
&tmpfile = GetFile(“c:\temp\file.txt”, “W”, “A”, %FilePath_Absolute);
&tmpfile.Delete();
Thank
Tim
August 3, 2010 at 4:45 pm
Great solution… Thanks a lot.
April 5, 2012 at 11:20 am
great solution .. it workd
August 13, 2012 at 10:21 pm
is there any java class to copy a file from source to destination?
October 22, 2012 at 2:06 pm
Raptor,
I am not sure that I fully understand your question. The java.io.File object is part of the delivered Java JRE, so you don’t need to add any Java files to your PeopleSoft to make this work. Is that what you are asking?