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

Uploads

Re: How to run chmod -R 777 using /script=SCRIPTNAME

Hi Martin,

Thank you for the quick response. Unfortunately I do not have shell access on that server. Sounds like I will be stuck running multiple chmod commands. Thanks again
martin

Re: How to run chmod -R 777 using /script=SCRIPTNAME

WinSCP chmod command does not support recursion.

But you may be able to use shell chmod command using WinSCP call command:
call chmod -R 777 main-directory
https://winscp.net/eng/docs/scriptcommand_call
Uploads

How to run chmod -R 777 using /script=SCRIPTNAME

Hi all,

I have a directory on an SFTP server that I want to run "chmod -R 777" against. The -R is important, ie I want the command to be recursive.

I want to accomplish this using the "winscp.com /script=SCRIPTNAME" command where the SCRIPTNAME file contains a list of commands for WinSCP to execute. I have used this method before. I don't want to use the "WinSCP .NET assembly and COM library" and I don't want to have to generate the SCRIPTNAME file on the fly.

Some places on the forum seem to state that WinSCP's chmod command is always recursive, but in my own tests I am finding this to *not* be the case. Also, I do not see an option to force WinSCP's chmod command to behave recursively.

Below is an example of how I am currently working around not having a recursive chmod right now. Here I am giving the main-directory/ directory 777 permissions recursively, but I am doing the recursive part manually.

#make the main-directory/ directory itself have 777 permissions
chmod 777 main-directory

#make the immediate children of the main-directory/ directory (non-recursively) have 777 permissions
chmod 777 main-directory/*.*

#make the immediate children of the main-directory/child-directory-1/ directory (non-recursively) have 777 permissions
chmod 777 main-directory/child-directory-1/*.*

#make the immediate children of the main-directory/child-directory-2/ directory (non-recursively) have 777 permissions
chmod 777 main-directory/child-directory-2/*.*

#make the immediate children of the main-directory/child-directory-2/child-directory-3/ directory (non-recursively) have 777 permissions
chmod 777 main-directory/child-directory-2/child-directory-3/*.*

and so on...


Is there a way to make WinSCP's chmod command behave recursively?

Thanks!