1

Upload file via FTP from Excel VBA was very helpfull, I'm using the code to synchronize a local folder to my FTP server.

Call Shell( _
     CurrentProject.Path & "\WinSCP.com /log=" & CurrentProject.Path & "\ftp.log /command " & _
     """open ftp://user:[email protected]/"" " & _
     """synchronize local " & localfolder & " /www/remotefolder/wines -filemask=""*.png"" " & _
     """exit""")

I'm trying to issue an exit command at the end, but the code gives me a

Too many parameters for command 'synchronize'.

The line in the log tells me

synchronize local C:\localfolder\wines /www/remotefolder/wines -filemask=*.png exit

The exit is in the same line as the synchronize one, when I use the put script this doesn't happen. What can I do to prevent this?

0

1 Answer 1

2

You are missing closing quote after the synchronize command. And the quotes around -filemask value have to be doubled. Or actually, you do not need them, as the value does not contain spaces.

This will do:

   """synchronize local " & localfolder & " /www/remotefolder/wines -filemask=*.png""" & _

See https://winscp.net/eng/docs/commandline#syntax


The symbol you have at the beginning of —hostkey and —rawsettings is not a simple hyphen-minus (-), but em-dash ().

Please use hyphen-minus (-) — what is the dash that you find on the standard English [and other] keyboards.

So actually you have the very same problem as in WinSCP forum post you referred to.


Or even easier, have WinSCP GUI generate a script template for you.

Also see FAQ Why are some WinSCP scripting commands specified in a batch file not executed/failing?


Other questions with the same error message, but different problem:

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your quick answer, worked as I want it. Love your work on WinSCP!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.