Topic "Script to loop through files and transfer them individually"

Author Message
Jo_L
[View user's profile]

Joined: 2015-03-04
Posts: 3
HI

I have an existing script (hostftp.bat) that will loop through a series of files and transfer them to a remote ftp site in the correct order (filename with a date stamp).

I need to modify this bat file to now also send these files to a separate FTPS site using WinSCP. The problem that I’m stuck on is that I’m not able to get the WinSCP command to loop through the files as the Windows command does.

For instance the calling code is attached (note the highlighted section is the piece I added to call the WinSCP script)




Hostftp.bat is attached


teagweb.txt is attached, however it’s not working.


I think I need to replicate the send %1 from the hostftp.bat file; however put %1 isn’t doing the trick. If I use “put *.xml”. It will copy all the files but won’t return to calling code to do the next file for hostftp.bat to process.
Any help is greatly appreciated.
Thanks
teagweb_txt.jpg (10.6 KB)

Description: (none)

teagweb_txt.jpg

hostftp_bat.jpg (46.77 KB)

Description: (none)

hostftp_bat.jpg

calling_code.jpg (16.74 KB)

Description: (none)

calling_code.jpg

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
1) You are missing /parameter switch:
winscp.com /script=taegweb.txt /parameter %1

2) You have to use %1% to refer to script parameter, not just %1:
put %1%

See
http://winscp.net/eng/docs/scripting#arguments
http://winscp.net/eng/docs/commandline#scripting
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