Posted Tue, 08 Feb 2022 19:26:13 GMT by Rochelle Adsitt evergreenDIRECT Credit Union IT Systems Engineer
Does anyone have a set a task steps they would be willing to share for downloading and deleting files and folders from an SFTP site?

The site may contain one or more folders at a time, each of which contains one or more files. But there may also be random files at the root level.

I need to log all of the files and folders I download so that I only delete the ones I've downloaded. The possibility exists that the site provider could be adding new files and folders while I'm in the process of downloading a current set, and the provider doesn't delete the files we've downloaded - it's up to us to delete them. But I also don't want to download the exact same set of folders and files and end up creating duplicate sets of files/folders.

And speaking of duplicates - the possibility also exists that the provider might update one or more files and provide a fresh copy of a file or folder, so I also need to check for existing files or folders and rename the new version before transferring them to the folder on our fileserver where users will be able to access them.

Should my task check for and deal with files at the root first and then deal with folders separately? I think I've figured out how to delete the files under the folders on the FTP site, but not sure how to go about accounting for and deleting folders once they are empty - maybe log folder names separately from the file names?

Can anyone help me with this?
Posted Wed, 15 Jun 2022 22:26:31 GMT by Amy Knode
Hi Rochelle,<br> <br> Attached is a sample task that calls ftp and deletes files from the server.&nbsp; There is an option to log the file downloaded into a dataset.&nbsp; You could loop through that dataset to determine what files you need to delete.&nbsp;&nbsp;<br> <br> I also think you may benefit from working with our services team to create a custom task to meet your needs.&nbsp; Let me know if you would be interested in speaking with someone from our services team.<br> <br> Thanks,<br> <br> Amy

You must be signed in to post in this forum.