Parametrized script help

Advertisement

victority
Guest

Parametrized script help

Hello,

I am trying to make a parametrized scrip to upload jpg files, but I got stuck.

I have servers.bat :

@echo off
"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server1.com/
"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server2.com/
"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server3.com/
"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server4.com/

"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server5.com/

And I have script.txt :

open %1%
put \\Files\Upload\*.jpg /
exit


Since the server5.com should have a different path to remote location (put \\Files\Upload\*.jpg /Folder), here the problem starts.
I tried to do with additional parameters, but I could not do anything.

Please help.
Thank you in advance.

Victor

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,227
Location:
Prague, Czechia

Re: Parametrized script help

In this particular case, you can make the path part of the URL:

"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server1.com/
...
"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server5.com/some/path/    

Note the /some/path/.

The script:

open %1%
put \\Files\Upload\*.jpg
exit    

(i.e. no second argument of the put)

Reply with quote

Guest

Re: Parametrized script help

martin wrote:

In this particular case, you can make the path part of the URL:

"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server1.com/
...
"C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server5.com/some/path/    

Note the /some/path/.

The script:

open %1%
put \\Files\Upload\*.jpg
exit    

(i.e. no second argument of the put)


Hello Martin,

Thanks for your reply.
I tried as you wrote. However, regardless of the path that I have added on the end, upload files to the root.

("C:\Program Files (x86)\WinSCP\winscp.com" /script=D:\Script\script.txt /parameter ftp://user:pass@server5.com/some/path/)

Do you have any other idea?

Thank you in advance.

Reply with quote

Guest

Re: Parametrized script help

The script:

open %1%
put \\Files\Upload\*.jpg
exit    


I found where the problem is, I forgot to take off "/" from the script
Now works perfectly, thank you.

Best regards.

Reply with quote

Advertisement

You can post new topics in this forum