I am trying to write a java in a SailPoint beanshell where I need to read a file and rename them. But the problem is filename has appending number that changes everyday according to date, ex. SampleFile0521, SampleFile0524. And I need to read a File with latest timestamp and starts with SampleFile .
Loading
Mohamed Azarudeen ZPosted Jun 17, 2023, 4:20 PM
Hi srikanth,
To read a file with the latest timestamp and a specific prefix in Java using the SailPoint BeanShell, you can follow these steps:
2. define directory
3. define prefix
4, create a file object in directory'
5.Create a
File[]array to store all the files6.Use a custom
Comparatorand Define a regular expression pattern to match the desired file format (prefix + date):7.erate through the sorted files
Check if a matching file was found and retrieve its nam