Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


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!

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