Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi: Routing on File Types, e.g. csv, tsv, xlsx

avatar

I have a connected SFTP server, and I am trying to route files based on type: `.csv`, `.tsv`, and `.xlsx`. For now, I'm just uploading test files through the command line.

My flow is:

GetSFTP (with correct hostname, etc.) ->

RouteOnAttribute ->

LogAttribute (will dump elsewhere soon, this is just for testing)

My problem, I think, is that I created a property in `RouteOnAttribute` incorrectly:

screen-shot-2018-12-05-at-120805-pm.png

Am I correct in assuming that this does not actually pick up on the `.csv` because it is not technically part of the filename? What would be the correct expression to route on the file type? Thanks!

1 REPLY 1

avatar
Super Mentor

@Robert Papel

I would suggest running your GetSFTP processor while leaving the RouteOnAttribute processor stopped log enough to get a some FlowFiles queued in the connection between those processors.

Then right click on that queued connection and select "list queue" from menu that appears.

From the list queue UI select a few different FlowFiles and look at the values assigned to the various attributes. Does filename show as being "<some value>.csv" or just "<some value>"?

If filename does not include extension, perhaps try using the IdentifyMimeType processor to see if it properly sets a "mime.type" attribute on each FlowFile which could then be used by your RouteOnAttribute processor.

-

Thank you,

Matt

-

If you found this answer addressed your question, please take a moment to login in and click the "ACCEPT" link.