TransferResumeSupport not respected
Hi all!
I'm set up for automation from Server 2012 with v5.15.7 build 10060. One of the recipients I SFTP to changed their structure to disallow change/delete after a file is placed. I updated my automation to set the transfer resume support state to Off but that isn't being respected. I also tried setting the transfer mode to Ascii, which should ignore resume itself, but I'm still breaking because it's still using .filepart.
This is at the top of the transfer/upload section:
I did go to the config and disable endurance as well and tried transferring through the GUI (file explorer) with the same result:
Automation:
I'm set up for automation from Server 2012 with v5.15.7 build 10060. One of the recipients I SFTP to changed their structure to disallow change/delete after a file is placed. I updated my automation to set the transfer resume support state to Off but that isn't being respected. I also tried setting the transfer mode to Ascii, which should ignore resume itself, but I'm still breaking because it's still using .filepart.
This is at the top of the transfer/upload section:
$transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Ascii $transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off $transferResult = $session.PutFiles($PGCSV, $PGFTP, $transferOptions)
I did go to the config and disable endurance as well and tried transferring through the GUI (file explorer) with the same result:
Upload of C:\[PATH]\[FILE].csv failed: Transfer was successfully finished, but temporary transfer file '[FILE].csv.filepart' could not be renamed to target file name '[FILE].csv'. If the problem persists, you may try to turn off transfer resume support. Permission denied. Error code: 3 Error message from server: Permission denied.
Automation:
param (
#Out to Dest
$PGCSV = "C:\[PATH]\*.csv",
#In at Dest
$PGFTP = "/Inbox/",
#Transmitted files archive
$PGArc = "C:\[PATH]\"
)
try
{#Connection
# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = "[HOST]"
UserName = "[USER]"
Password = "[PASS]"
SshHostKeyFingerprint = "[KEY]"
}
$session = New-Object WinSCP.Session
$session.AddRawConfiguration("Interface\LocaleSafe", "1033")
$session.SessionLogPath = "C:\[PATH]\[FILE].log"
Write-Output "-----Start-----"
Get-Date -UFormat "%m/%d/%Y %R:%S"
# Connect
Write-Output "Opening session..."
$session.Open($sessionOptions)
try
{#CSV
# Upload files, collect results
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinSCP.TransferMode]::Ascii
$transferOptions.ResumeSupport.State = [WinSCP.TransferResumeSupportState]::Off
$transferResult = $session.PutFiles($PGCSV, $PGFTP, $transferOptions)
# Iterate over every transfer
foreach ($transfer in $transferResult.Transfers)
{
# Success or error?
if ($transfer.Error -eq $Null)
{
Write-Output "Upload of $($transfer.FileName) succeeded, moving to backup..."
# Upload succeeded, move source file to backup
Move-Item -Path $transfer.FileName -Destination $PGArc
}
else
{
Write-Output "Upload of $($transfer.FileName) failed: $($transfer.Error.Message)"
}
}
}
catch
{#CSV
Write-Output "PG Error: $($_.Exception.Message)"
exit 1
}
finally
{
Write-Output "Disconnecting session, cleaning variables..."
# Disconnect, clean up
$session.Dispose()
Get-Date -UFormat "%m/%d/%Y %R:%S"
Write-Output "-----End-----"
}
exit 0
}
catch
{
Write-Output "Error: $($_.Exception.Message)"
Get-Date -UFormat "%m/%d/%Y %R:%S"
Write-Output "-----End-----"
exit 1
}