Support Questions

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

I want fetch the files based on some wildcard in NIFI

New Contributor

I want to fetch the files based on wildcard(*xyz*.txt) in nifi and if files are not available then it will keep on looping again check whether the files are exist or not. Can you please suggest the solution in NIFI. Files are present in server. 




I think what you need is the GetFile processor and not FetchFile. In the Fetch File you have to specify the exact file path and name that you want to fetch and you can't use wild card. However in the Get File you specify the path in the "Input Directory" then you can use Regex  in the "File Filter" property to capture files with certain pattern. In your case the search pattern in Regex will be something like ".*xyz.*\.txt"


You need to watch for other Properties like "Keep Source File" which decide what to do with the file after its picked up. If you want to loop indefinitely then "False" would be the right value. Once the file is picked up you can save it somewhere else using PutFile processor. The "Recurse Subdirectories" let you decide wither you want to search root folder only or all folder levels.

If that helps please accept solution.