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

does listsftp anf fetchsftp stores the directory structure?

Contributor

Hi All,

Thanks a lot to this awesome community.

I am trying to replicate a directory structure from where I am listing and fetching the files using list and fetchsftp

I did a PoC and I can see it stores the filename but not sure if it can store the directory structure if I give the top level direcotry to list.

Any suggestion or help

Thanks

1 ACCEPTED SOLUTION

Super Guru
@dhieru singh

You can get directory structure from path attribute associated with the flow file,

path //The fully qualified name of the directory on the SFTP Server from which the file was pulled.

Filename attribute will give you the actual file name that got pulled from the directory

filename //The name of the file on the SFTP Server

in Fetchsftp processor we are going to use

${path}/${filename} //to fetch the actual file this expression will give directory and also file path.  

if you give top level directory and

Recurse Subdirectories property to true the processor will navigate through all the subdirectories are in that top level directory(if nifi having access to those sub directories) and list all the files in those sub directories.

Each flowfile will have path,filename attribute as path attribute gives you from which directory the file got pulled from and filename attribute gives you actual filename of the file.

View solution in original post

1 REPLY 1

Super Guru
@dhieru singh

You can get directory structure from path attribute associated with the flow file,

path //The fully qualified name of the directory on the SFTP Server from which the file was pulled.

Filename attribute will give you the actual file name that got pulled from the directory

filename //The name of the file on the SFTP Server

in Fetchsftp processor we are going to use

${path}/${filename} //to fetch the actual file this expression will give directory and also file path.  

if you give top level directory and

Recurse Subdirectories property to true the processor will navigate through all the subdirectories are in that top level directory(if nifi having access to those sub directories) and list all the files in those sub directories.

Each flowfile will have path,filename attribute as path attribute gives you from which directory the file got pulled from and filename attribute gives you actual filename of the file.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.