Skip to main content
ShyamKumar
Silver ⭐️
Jun 13, 2023 8:06 AM UTC
Question

I want fetch the files based on some wildcard in NIFI

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. 

1 reply

SAMSAL
Platinum ⭐️⭐️⭐️
Jun 13, 2023 1:47 PM UTC

Hi,

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"

SAMSAL_0-1686663795689.png

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.

Thanks

Translate