- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Nifi SFTP Mutiple Files into Mutiple HDFS directories (Based on file name)
- Labels:
-
Apache NiFi
Created 02-22-2017 09:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Created 02-22-2017 10:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created 02-22-2017 10:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created 02-22-2017 10:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, this is exactly what I'm looking for!
Created on 02-22-2017 10:08 PM - edited 08-19-2019 03:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
Of course you will want to modify the above for the complete target path.
Thanks,
Matt
