Not sure if this is the right forum or not. Been automating WinSCP using some Powershell scripts. But when I do an upload I get this error:
PS R:\PowerShellScripts> .\SFTPToPDCs.ps1 Beginning FTP Upload. Upload of file '1208E.pjb' was successful, but error occurred while setting the permissions and/or timestamp. If the problem persists, turn on 'Ignore permissio n errors' option. PS R:\PowerShellScripts> .\SFTPToPDCs.ps1
So looking around the documentation I stumbled on this:
and this to remove it via the GUI or command line - https://winscp.net/eng/docs/ui_transfer_custom#upload
So how would I implement this in my script? I looked at the PS examples but no go.
Would this work? (text in red)
$transferOptions.FilePermissions = $Null
The idea is to keep the permissions the same when I upload the files.
# Connect Write-Host "Beginning FTP Upload." $session.Open($sessionOptions) # Upload files $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary $transferOptions.FilePermissions = $Null $transferResult = $session.PutFiles("R:\RESOURCES\Data\*", "/users/xfer/", $FALSE, $transferOptions)