Use java.io.File in PeopleCode to list files in directory

851 views Asked by At

I would like to be able to create a list ,array, of file names on a folder so that I can use PeopleCode to loop through them and delete files that match a pattern and are in a date range.

I'm pretty sure I have the last half of that, matching a pattern and in a date range, but I do not know how to get the list on remote servers. I can do it on our local servers, but not remote ones.

I had hoped that this would work: Local object &files = CreateJavaObject("java.io.File", SFO_DEL_FTP_AET.FTPDIRECTORY | "*.*"); But I don't think it is working.

Can somebody help me?

Thanks,

JPS

1

There are 1 answers

2
cuda On

You can use Java to access/modify the files in a directory. Try:

Local JavaObject instead of Local object

We created a PS component to view, upload, and delete files in an App Server directory. You can see how we did it here:

https://github.com/cy2hq/PeopleSoft-Directory-Viewer