Reputation: 105
I want to read a file dynamically from a SFTP location on day to day basis, based on the date in the file name for example. I'm using ListSFTP's file filter regex to match only those files with todays date,
For example, today's file is data_04142021.csv, and tomorrow it would be data_04152021.csv
Which file filter regex can I use to do that?
I've been trying ^data_[${now():format('MMddyyyy')}].* but with no success.
Any help would be appreciated.
Upvotes: 1
Views: 1433
Reputation: 547
You should use ListSFTP
and FetchSFTP
together. First of all, list files in directory and use RouteOnAttribute
to filter out today's file and lastly, get content of the file. I am using ListFile
and FetchFile
in my example but approach is the same.
you can add a route on RouteOnAttribute
like this
${filename:contains(${now():format('MMddyyyy')})}
Upvotes: 1