Legacy code. I’m trying to get this string to write the actual number of files that it wrote out. Right now it writes out {0} for each file. What am I missing? How do i get it to say 1 or how do I cleanly remove this?
#Printing output for AGCH_FHMC
$AGCH_FHMC_counter = 0
foreach ($transfer in $transferResult_AGCH_FHMC.Transfers)
{
#Success or error?
if ($transfer.Error -eq $Null)
{
#Print results
Add-content -Path $logpath -value “Upload of {0} succeeded, moving to archive $($transfer.FileName)”
$AGCH_FHMC_counter++
#Upload succeeded, move source file to backup
Move-Item $transfer.FileName $AGCH_FHMC_Archive
}
else
{
#Upload Failed, throw error
Add-content -Path $logpath -value “Upload of {0} failed: {1} $($transfer.FileName) $($transfer.Error.Message)”
}
}
Add-content -Path $logPath -value “$($AGCH_FHMC_counter) files successfully uploaded from AGCH_FHMC.”