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("", "c:\temp\mytextfile.txt");



8 Responses to “Deleting Files from PeopleCode”

  1. Andrew Says:

    Thanks, very nice. Something different, instead of using the delete method of the file object.

  2. Larry Says:

    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 website.


  3. Madhan Says:

    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.

  4. Tim Says:

    Thanks for the tip. I’ve used the following and it work well to.

    &tmpfile = GetFile(“c:\temp\file.txt”, “W”, “A”, %FilePath_Absolute);


  5. Shyam Says:

    Great solution… Thanks a lot.

  6. Abhay Says:

    great solution .. it workd

  7. Raptor Says:

    is there any java class to copy a file from source to destination?

    • Stephen aka DigitalEagle Says:


      I am not sure that I fully understand your question. The 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?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: