After much head banging I figured out what was going on.
It was two things really, but here's what I ended up with:
# Iterate over every download
foreach ($upload in $synchronizationResult.Uploads)
# Success or error?
if ($upload.Error -eq $Null)
Write-Host "Upload of $($upload.FileName) succeeded, removing from source"
# Upload succeeded, remove file from source
$filename = ($upload.FileName)
Write-Host "Removing of file $($upload.FileName) succeeded"
Write-Host "Removing of file $($upload.FileName) failed"
"Upload of $($upload.FileName) failed: $($upload.Error.Message)")
Firstly, I was referencing
, so I adjusted all of my references for that (and updated my comments).
Secondly, I was using
to remove the local file, which would not work because it was prepending my file name with the root directory of the remote FTP server. Instead I used a straight up
command to remove the local file, and the
variable to determine success or failure of that operation.
Anyway, I didn't find anything to point this out to me, so I thought I'd share in case others run across this.