@dhieru singhYou 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.