Topic "Parametrized script help"

Author Message
victority

Guest


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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
In this particular case, you can make the path part of the URL:

Code:
"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:

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


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




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

Code:
"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:

Code:
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.
Guest




The script:

Code:
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.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License