Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Remove file from service export directory

SA-6193

Summary



How can we remove a jar file from a directory automatically after the product import is complete.


Resolution


 

While there is no out of the box activity that deletes a particular file. This is possible via a custom activity.  The following is an example of code for deleting only the service export directory where the jar files or temporary attachments reside before they are imported into the database. If you want to delete any particular file from this service directory, you will have to make sure to get the file handle for that specific file using the absolute filepath or the PRFile API.

 

String tempPath = tools.getProperty("pxProcess.pxServiceExportPath").getStringValue();

PRFile afile = new PRFile(tempPath);

String list[] = afile.list();

for (int i = 0; i < list.length; i++) {

  oLog.infoForced(i+"I:"+list[i]);

  afile = new PRFile(tempPath+list[i]);

  oLog.infoForced("delete Status"+afile.delete());

}

 

There is also an option from the SMA to delete the entire static content cache.

Published January 31, 2016 - Updated October 8, 2020

Was this useful?

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us