File permissions unchanged

Advertisement

nevi
Joined:
Posts:
7

File permissions unchanged

Hello
I am using the .NET assembly in PowerShell to upload files. I also want to change the file permissions, in this case to octal 777.
I tried your suggestion from post https://winscp.net/forum/viewtopic.php?t=14913. But for some reason (unknown to me), the permissions are not set as intended. This is true even though the log file has an entry beginning with: Script: put -permissions="777" -preservetime -transfer="binary" - for each of the files I am uploading.

The PowerShell snippet I am using is this:
$FTPTransferOptions = New-Object -TypeName WinSCP.TransferOptions
$FTPTransferOptions.TransferMode = [WinSCP.Transfermode]::Binary
$FTPTransferOptions.OverwriteMode = [WinSCP.OverwriteMode]::Overwrite
$FTPTransferOptions.FilePermissions = New-Object -TypeName WinSCP.FilePermissions
$FTPTransferOptions.FilePermissions.Octal = '0777'

I hope you are able to shed some light on this issue.
Thank you very much.

Kind regards,
Neilsean Lavlund Victorino

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: File permissions unchanged

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

nevi
Joined:
Posts:
7

Thank you for your feedback. I have attached a log file with this comment. The contents of the file are partially anonymized.
I also just want to point out, that I have no problem changing the files permissions on the FTP server using the WinSCP GUI and the same FTP credentials, that I use in the script.
  • log.txt (8.35 KB, Private file)

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum