Uploading multiple files with script

Advertisement

Ulrike
Guest

Uploading multiple files with script

Hi,

i'm uploading multiple files via script to one SFTP server. Each file is done with one script. After uploading 5 files (running 5 scripts) the login to the server is not possible for the next 2 or 3 minutes.
option batch on
option confirm off
open sftp://<user>:<pw>@<ip>:<port>
session
option transfer binary
put <file>
exit
Any suggestions?

Regards,

Ulrike

Reply with quote

Advertisement

RickB
Joined:
Posts:
2
Location:
Australia

Re: Uploading multiple files with script

The simplest (but not most elegant) solution is to list all files in the one script:
option batch on
option confirm off
open sftp://<user>:<pw>@<ip>:<port>
session
option transfer binary
put <file1>
put <file2>
put <file3>
put <file4>
put <file5>
put <file6>
put <file7>
exit
But why don't you use a wildcard instead? For example, if all the files you are uploading share the same extension (for example .txt) you could do this:
put *.txt
There are other examples here:
https://winscp.net/eng/docs/scriptcommand_put

Reply with quote

Ulrike
Guest

Uploading multiple files with script

Hi,

thanks for the reply.

The reason for uploading the files one by one is to make sure that every and each file succeeded. I'm writing the script for the upload from code. And I can only get the return code from the whole script (as far as I know). As there are multiple formats files in multiple destinations wildcards won't work. :(

Any suggestions? Is this a known behaviour?

Regards,

Ulrike

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,506
Location:
Prague, Czechia

Re: Uploading multiple files with script

Ulrike wrote:

i'm uploading multiple files via script to one SFTP server. Each file is done with one script. After uploading 5 files (running 5 scripts) the login to the server is not possible for the next 2 or 3 minutes.
It seems like you have some connection limit set on your server.

Reply with quote

Advertisement

You can post new topics in this forum