GetFileToDirectory Not Overwriting File, even though OverWriteMode set to Overwrite
I'm downloading one file at a time using
I could delete the local file manually if present, before downloading, but WinSCP has an
Please check these
$session.GetFileToDirectory
in PowerShell, yet if a file of the same name already exists in the local folder, it is not getting overwritten, *which I want it to*, in this case.
I could delete the local file manually if present, before downloading, but WinSCP has an
OverwriteMode
, yet I may have its syntax wrong, because it's not overwriting, even though I am setting it to.
Please check these
$transferOptions
and let me know what if anything I can do to cause files with the same name downloaded via GetFileToDirectory
to overwrite identically named files in the local directory.
$transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary $transferOptions.PreserveTimestamp = $true $transferOptions.FilePermissions = $Null # This is default $transferOptions.transferOptions = [WinSCP.OverwriteMode]::Overwrite