Post a reply

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


Re: transfer.Options File Permissions

Thanks Martin - worked a treat.

So the code should be:

$session.PutFiles($localPath, $remotePath, $False, $transferOptions)

transfer.Options File Permissions


I'm trying to set the transfer options to ignore file permissions and timestamps but i'm still receiving the error back from the server:

< 2019-02-28 10:23:16.188 Error message from server: This server does not support operations to modify file attributes. File attributes for [/Inbox/move_me.xml] were not modified.
* 2019-02-28 10:23:16.189 (ESkipFile) **Upload of file 'move_me.xml' was successful, but error occurred while setting the permissions and/or timestamp.**
* 2019-02-28 10:23:16.189
* 2019-02-28 10:23:16.189 If the problem persists, turn off setting permissions or preserving timestamp. Alternatively you can turn on 'Ignore permission errors' option.
* 2019-02-28 10:23:16.189 Permission denied.

code is here:


        # Connect
        # Set options, upload files, collect results
        $transferOptions = New-Object WinSCP.TransferOptions
        $transferOptions.FilePermissions = $Null
        $transferOptions.PreserveTimestamp = $False
        $transferResult = $session.PutFiles($localPath, $remotePath, $transferOptions)

        # Iterate over every transfer
        foreach ($transfer in $transferResult.Transfers)
            # Success or error?
            if ($transfer.Error -eq $Null)
                Write-Host "Upload of $($transfer.FileName) succeeded, moving to backup"
                # Upload succeeded, move source file to backup
                Move-Item $transfer.FileName $successPath
                Write-Host "Upload of $($transfer.FileName) failed: $($transfer.Error.Message)"

        # Disconnect, clean up

Any ideas why its not passing or being ignored by the server perhaps?

PS C:\Users\xxxxxx> $transferOptions

PreserveTimestamp : False
FilePermissions   :
TransferMode      : Binary
FileMask          :
ResumeSupport     : default
SpeedLimit        : 0
OverwriteMode     : Overwrite