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

info_you85

Thanks.
It works with SFTP connection and -permissions option.
martin

Indeed, the -permissions works for SFTP and SCP only, as the documentation says:
https://winscp.net/eng/docs/scriptcommand_synchronize#permissions

With FTP, you would have to use WinSCP .NET assembly e.g. from PowerShell script. The script would have to iterate synchronized files and call respective FTP command (SITE CHMOD ...) to change the permissions for each of them (via Session.ExecuteCommand, as the .NET assembly does not expose the chmod functionality directly).

There's a guide for Converting Script to Code Based on .NET Assembly. Though in your case, it's probably straightforward.
info_you85

Does someone know if it's normal that the option -permission didn't work with he FTP connection?
I don't have choice to use SFTP connection for use this option?

Thanks
info_you85

Thanks for your reply.

I already try the -permissions but it doesn't work, I guess it's because I use FTP and not SFTP?
I will try again ;)
martin

Re: Synchronize and only change permissions to new files

You can make synchronize command change permissions of the synchronized files:
synchronize remote ... -permissions=644

(it will also set permissions of newly directories – to 755).
info_you85

Synchronize and only change permissions to new files

Hello,

I made a script who synchronize a local folder to a remote folder: it works fine
After I execute a chmod 644 on all files with extensions *.pdf for example: it works but it take long time because it change the permissions for all files: the new ones and the olders who already have the good permissions.
Is it possible to "filter" the chmod only to the new files I just synchronized? Like files who are modifies under 24hours for examples?

Thanks