There isn’t a built-in “mget” service for SFTP, but it does exist for FTP. You are experiencing a failure probably because you used “*” in localFile (this is for your filesystem) and instead of remoteFile (for the SFTP filesystem).
Having said that, I don’t recall how pub.client.sftp:get would behave if I tried to download multiple files. Can you try the following -
- Use
\\folderPath\
* in remoteFile and see what happens
- If #1 fails, then use “pub.client.sftp:cd” first to navigate to
\\folderPath
and then only use *
in remoteFile
- If either #1 or #2 are successful, then try expanding by using a file pattern now
\\folderPath\filePattern*
(example \\folderPath\Emp_*_2022*.csv
)
Alternative - If all the above fail, then your alternative solution will work, but remember the difference between localFile vs remoteFile.
Libraries - Another way is to use a Java library (such as JSch, Apache Commons VFS, etc.), but I won’t recommend using libraries if you can achieve it with services and there’s a justifiable reason for their use.
KM
#SFTP#Integration-Server-and-ESB#webMethods