Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Highlighted

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..

2 REPLIES 2

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

@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:

16000-screen-shot-2017-06-05-at-85847-am.png

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.

Highlighted

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

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!

https://issues.apache.org/jira/browse/NIFI-4041

Don't have an account?
Coming from Hortonworks? Activate your account here