Support Questions

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

how to filter file based on size file..??

New Contributor

I need help.. actually I am recently using nifi. I have realtime files that always created every minutes, but I just want put 4 MB of every file and I wont put file with lower size.. best regard to your response.. I using filter like ${fileSize:minus(4000000)} to filter 4 MB file, but It's doesn't work,.. I using listSFTP >> RouteOnAtribute >> FetchSFTP >> putFile..



@rian amrodin

If I understand your question, you want to route files larger than 4MB down a different path from the files smaller than 4MB.

In the RouteOnAttribute processor, add a property like:


Files greater than 4MB will be routed out the gt4mb realtionship and the files that are smaller than 4MB will go out the unmatched relationship.


Hello @rian amrodin

As @Wynner suggested, you should be able to route FlowFiles based on file size using 'gt()' EL function. However surprisingly, ListFTP and ListSFTP doesn't write 'file.size' attribute where it's supposed to do.. I submitted a JIRA NIFI-4041 and a fix for that. I hope it will be merged and available soon. Thanks for sharing your experience with Apache NiFi!