1

I have an excel VBA script to take a file and upload it to my FTP site. What I would like to do is add a -speed switch to the command to limit the transfer speed to something like 700k. I have the following code now that works great, just doesn't limit:

Call Shell( _
"C:\1a7j42w\WinSCP\WinSCP.com /log=C:\1a7j42w\WinSCP\excel.log /command " & _
"""open ftp://xxxxxxx:xxxxxxx@ftp.kaltura.com/"" " & _
"""put """"" & RealFile & """"""" " & _
"""exit""")

And I know from the WinSCP page here (https://winscp.net/eng/docs/scriptcommand_put) that I need to add a -speed=<700> after the put command, but I'm confused by all the quotes, and placement of this speed switch. I tried adding it after the put command so it was like this:

"""put -speed=<700>""""" & RealFile & """"""" " & _

but that did not work. I also tried adding another space after the close bracket behind 700 and in front of the quotes, but that did not work either.

I'm sure I'm just not placing it in the correct location or doing the quotes/spaces right, but I'm not sure where to go from here. Any help would be greatly appreciated.

Community
  • 1
  • 1
Jarmer
  • 25
  • 1
  • 4
  • Your put command looks like this in the `shell` command if I try your code: `"put ""RealFileContents"""` - seems like a strange amount of quotes? Maybe you could try single quotes instead, and just use one on either side of the file name? – Olle Sjögren Jan 15 '16 at 15:34
  • The amount of quotes, and direct syntax came from this post (http://stackoverflow.com/a/33687368/4946876) by Martin Prikryl (http://stackoverflow.com/users/850848/martin-prikryl) - and it works very well, he describes in that post why the amount of quotes. -- I just don't know where in there to add the switch. – Jarmer Jan 15 '16 at 15:55
  • OK, forget my comment! :) – Olle Sjögren Jan 15 '16 at 16:06

1 Answers1

1

It's not -speed=<700>, but -speed=700. Also, you miss a space after the switch.

So the correct code is:

"""put -speed=700 """"" & RealFile & """"""" " & _

Reference: https://winscp.net/eng/docs/scriptcommand_put

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Got it. Tried it and it worked! Thank you again for the help. So my second try would have worked had I not used the brackets. That's good to know for other switches. Thanks again. – Jarmer Jan 15 '16 at 16:35