I've got a script that's running multiple times a day which uploads file to several FTP servers.
However, I need to change file permissions on the uploaded files on one of them but am hitting a wall, and I cannot see what I'm doing wrong:
$transferOptions = New-Object WinSCP.TransferOptions
$transferOptions.TransferMode = [WinScp.TransferMode]::Binary
$transferOptions.PreserveTimestamp = $true
$transferOptions.FilePermissions.Octal = $filePerm
$transferOptions.OverwriteMode = [WinSCP.OverwriteMode]::Overwrite
$transferResult = $session.PutFiles("$Path$Filename", "$ftpPath$filename", $false, $transferOptions)
Powershell response:
Error: The property 'Octal' cannot be found on this object. Verify that the property exists and can be set.
All I did was add the filepermission line. I've updated the DLL to the most recent release I could find (5.13.2) and tried other properties as well, but get the same response. If I comment it out, it runs as expected (without file permission being set).