Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

SFTP Connector (SFTPFileTransfer Connector) - Regex to match current date in a report name

yogesh
Regular Contributor III
Regular Contributor III

Analytics reports are created in the Reports directory with names like this:
Analytics_Summary_MyReport_20231215_102802.xlsx

I am trying to make an SFTP connection that only transfers the files that match today's date I have tried below json in FILES_TO_PUT parameter :

 

[
    {
        "eic_src_dir": "Reports",
        "target_dir": "/remote/server/path",
        "regex_list": [
            "Analytics_Summary_MyReport_${Calendar.getInstance().getTime().format('yyyyMMdd')}.*"
        ]
    }
]

 

 But this is not working and whenever I am using any groovy expression in the regex I get error in the JOB:

Illegal repetition near index
43 Analytics_Summary_MyReport_${Ca
lendar.getInstance().getTime().format('yyyyMMdd')}
.* ^,
Refer connectorms logs for troubleshooting

Is groovy not supported in this connector's FILES_TO_PUT json field?

How can I accomplish my usecase? Any suggestions?

Second similar usecase: Just transfer the most recent file only. So if we have files like :

Analytics_Summary_MyReport_20231215_102802.xlsx
Analytics_Summary_MyReport_20231215_110000.xlsx
Analytics_Summary_MyReport_20231215_130000.xlsx

I want to tranfer only the most recent file i.e. the third one. But I'm not sure how to write a regex for that.

2 REPLIES 2

sk
All-Star
All-Star

@yogesh : I doubt groovy expressions support. But have you tried modified_since option to see if that works as an alternative?

Also if it make sense you can use delete_from_source along with modified_since

sk_0-1702661315041.png

 


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

yogesh
Regular Contributor III
Regular Contributor III

I have tried both these cofigurations and neither of them worked for me.

delete_from_source doesnt delete any files, even when the user has full permission to do whatever it wants on the sftp server.

and modified_since also does not work, no matter what I set it to, even files which are several days old get copied.

I already have support tickets open with Saviynt on these parameters, hence I was trying groovy while I wait. We are on 23.11 so as per documentation these should work for us, or it could be that the connector files are still older version somehow. I'll have to wait and see.