Post a reply

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

Options

Topic review

nevi

Thank you for your reply.
Just for clarity, can you please inform in which situation, the use of the "New-Object -TypeName WinSCP.FilePermissions" cmdlet (as you suggest in https://winscp.net/forum/viewtopic.php?t=14913) is applicable?
nevi

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

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

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