Support Questions
Find answers, ask questions, and share your expertise

Does the FetchSftp Processor support wildcards?

Highlighted

Does the FetchSftp Processor support wildcards?

Explorer

I am trying to fetch a file that has a date time stamp added to the beginning of the filename on a remote server.

like this 2017-13-04_file123.txt.gz

And I know the file is named file123.txt

I have tried doing this as the remote filename fetch: /home/user/*${FileToFetch}*

Where FileToFetch is file123.txt

There is no way for me to assume that the filename will start with a specific date or for me to know the file extention.

4 REPLIES 4
Highlighted

Re: Does the FetchSftp Processor support wildcards?

Super Guru

@John T

I am a little confused since you say file name is "file123.txt" but then say you don't know how the file name starts or what the extension is (seems like extension is .txt).

Remote File Name supports expression language so you should be able to use "contains" for the file.

Highlighted

Re: Does the FetchSftp Processor support wildcards?

Explorer

@mqureshi

That's not quite what I'm looking for.

I know the the filename on the REMOTE system contains file123.txt.

There may be any nubmber of random characters of numbers preceding or proceeding "file123.txt"

Adding contains wont work because I need the remote file fetch to get all files that have file123.txt in the filename.

Not have nifi look to see if the attribute contains something.

John

Highlighted

Re: Does the FetchSftp Processor support wildcards?

@John T

Try using this for the Remote File property /home/user/.*${FileToFetch}.*

The ".*" says any character, any number of characters. So for your example, it will grab any file that contains "file123.txt" anywhere in the name.

Highlighted

Re: Does the FetchSftp Processor support wildcards?

Master Guru
@John T

If you are using the listSFTP processor before your FetchSFTP processor , it will produce a zero byte flow flowfile for every FlowFile it finds on the target SFTP server. The listSFTP processor has a "File Filter Regex" where you can specify a java regular expression to limit what is returned to just files containing "file123.txt". For example "*file123.txt"

The ListSFTP processor also maintains state so that the same files are not listed each time. so only new files containing file123.txt are listed each time it runs.

The FetchSFTp processor is designed to return the content of a specific file and insert it as content to the FlowFile that he FetchSFTP processor is running against.

Thanks,

Matt

Don't have an account?