Support Questions

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

Nifi SFTP Mutiple Files into Mutiple HDFS directories (Based on file name)

avatar
Expert Contributor

Trying to move files via Nifi using GetSFTP. Let's say the filename is "DATA1". I want to move DATA1 into HDFS directory DATA1. I also want to do this with DATA2, DATA3, etc... How would this be possible via Nifi without creating a process for each file?

1 ACCEPTED SOLUTION

avatar
Master Guru

Use expression language in PutHDFS for the value of the Directory property, so setting it to ${filename} would put each file into a directory named the same as the filename attribute of each flow file in NiFi.

View solution in original post

3 REPLIES 3

avatar
Master Guru

Use expression language in PutHDFS for the value of the Directory property, so setting it to ${filename} would put each file into a directory named the same as the filename attribute of each flow file in NiFi.

avatar
Expert Contributor

Thanks, this is exactly what I'm looking for!

avatar
Super Mentor
@Joe Petro

Yes this is very doable...

NiFi automatically creates a FlowFile Attribute called "filename" on every FlowFile that is created. You can use this existing attribute to specify teh target HDFS directory:

12839-screen-shot-2017-02-22-at-50732-pm.png

Of course you will want to modify the above for the complete target path.

Thanks,

Matt