I found another post on here about how to FTP upload some files. it's working great, but I want to have a bit more information output. Here's snippet of what I have and what I'd like to do
foreach ($file in $uploadfiles)
{
# create the full path to the file on remote server (odd but okay!)
$ftp_command = $ftp + $file
# for debugging
#$ftp_command
# create a new URI object for the full path of the file
$uri = New-Object System.URI($ftp_command)
#for debugging
#$uri
# finally do our upload to the remote server - URI object, full path to local file
$result = $ftpclient.UploadFile($uri,$file.Fullname)
if ($result) {
$file.Fullname + " uploaded successfully"
} else {
$file.Fullname + " not uploaded successfully"
}
}
Basically the if/else loop at the end of the foreach. I want to test for the return from the UploadFile. I'm new to PowerShell but not to programming and just having this little issue.
Thanks in advance