VHello Integration Folks,

In this blog post you will be knowing how to route files based on filenames.

Business Case: I had a requirement in my project to poll the files with different filenames from the same SFTP directory server via CPI and send it to 3rd party SFTP server.


Use router to route incoming files based on the filenames. For ex., SalesOrder2021_05_18T051632.csv , ScheduleOrder2021_05_18T041812, etc.

1. Create your iflow and configure your sender SFTP.

2. Connect Router in order to route the files.


3. Select expression type as Non-XML and provide conditions as :

${header.CamelFileName} regex ‘SalesOrder.*’ for first router

${header.CamelFileName} regex ‘ScheduledOrder.*’ for second router

and keep last router as default route.

-> ${header.CamelFileName} regex ‘x.*’ means it will route all the messages that have a filename starting with x.

For more information on usage of non-xml conditions, click here.

Conclusion: You will now be able to route incoming files to different routes based on filename and can perform modifications/ transformations as required.

I am new to CPI, please keep supporting and suggest improvements.

Happy learning !!!

Thanks & regards,

sachin tripathi

Randa Khaled

Randa Khaled

Author Since: November 19, 2020

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x