TransferOptions.FilePermissions properties not found

Advertisement

IrquiM
Joined:
Posts:
2
Location:
Norway

TransferOptions.FilePermissions properties not found

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).

Reply with quote

Advertisement

IrquiM
Joined:
Posts:
2
Location:
Norway

Looks like it was my fault for guessing the .octal worked without having to also add
$transferOptions.FilePermissions = New-Object WinSCP.FilePermissions
since it came up on IntelliSense.

Works now!

Reply with quote

Advertisement

You can post new topics in this forum