Support Questions
Find answers, ask questions, and share your expertise

RouteOnAttribute Expression for Today's Date - NIFI

New Contributor

Hi everyone, 

I want to use a RouteOnAttribute to only pick up files with the current date. What expression can I use to achieve this? 


The files in the SFTP I am fetching from are suffixed with a date as follows: 







@Makaveli  The solution you are looking for here is updateAttribute to create your string of the date format you want.  todayString = 


Then in routeOnText you use this attribute like this:  newRoute = 




If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.




New Contributor

@stevenmatison thanks for the reply. So you're saying from my LISTSFTP processor I should connect a UpdateAttribute processor with the expression you mentioned, then have a RouteText processor connected to the UpdateAttribute processor? 


I tried the above and the UpdateAttribute is picking up all files in the SFTP regardless of the date today, any recommendations? 



@Makaveli  You can use File Filter Regex in ListSFTP to control which files come out of this processor.   Otherwise, you need to use ListSftp->UpdateAttribute->RouteOnAttribute to make sure the file name ends as suggested above.  Once you have a solid route of the files you want, then connect to FetchSFTP.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.