Powershell to check FTP command results

Stefano Colombo 221 Reputation points
2023-01-10T15:50:18.977+00:00

I'm trying to create some scripts to upload/download files via ftp and wonder how to catch the results to see if the operation succeeded for all the files. We are using several functions that made the jobs , and got an output like the following

MKD for 'ftp://192.168.1.131/OUT//bck' executing Response: '257 "/OUT/bck" created successfully. ' STOR for 'ftp://192.168.1.131/OUT//bck/az.exe' complete' STOR for 'ftp://192.168.1.131/OUT//bck/Estimate.xlsx' complete'

How can we catch such outputs to check for possible error during the FTP ?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,363 questions
{count} votes