SFTP recursively list files for comparison

Hello! I am just beginning to explore Automise as a tool to enhance our automation. I am looking to replace/augment some file transfers scripts that have been cobbled together via PowerShell & WinSCP over the years.

One task that I am automating involves downloading a folder hierarchy from a remote SFTP server to a local file share. I have the SFTP connection and download working flawlessly. I would like to be able to compare the contents of the source hierarchy with the downloaded hierarchy to ensure the integrity of the download, as an extra safeguard. Counting files would be sufficient. I'm including the download log into a variable, and that lists out all of the downloaded files recursively. I haven't found a way to list the source files (on the SMTP server) recursively. It looks like SFTP List Files will only list the first branch of the root directory. I am guessing I may need to either manually send an SFTP command (how can I do this?) or use some sort of iterator loop. I am continuing to experiment but would appreciate any points in the right direction. Thank you!

Chris

Hi Chris

Unfortunately there isn't a simple solution to this in Automise at the moment. There is a SFTP List Files action that will allow you to get the remote file list for a folder, but there's no way to recurse at the moment. If you are able to use FTPS instead, then you could use the FTPS Mirror action to achieve what you need.

I actually found myself needing an SFTP Mirror action today (automating offsite backups), so I'll add that to the list for the next version. I've not looked at how difficult it will be to do, but the plan for FB9/AT6 is to combine FTP/FTPS/SFTP into a single set of file transfer actions (using a new client library that supports all the protocols) and that will make sftp mirroring possible.

2 Likes

Thanks for the reply Vincent - I can work around this for now with a few extra steps, and it’ll be nice to have in future versions.
Enjoying what I’ve found can be done with the software so far!