Batch File Ends After 295 File Transfers

Advertisement

Tina_412
Joined:
Posts:
1

Batch File Ends After 295 File Transfers

I am transferring alot of small files and for some reason it dies off after 295 files exactly.

The log file will close off with this strange error. I can't tell if it's some kind of timeout during the transfer, or if there is some kind of limit to how many files can be transferred within a script. I have a script with a massive amount of files in it, (About a couple thousand or so) I don't want an entire directory, I am trying to pull a specific list of files from a specific directory so there's a massive amount of "get filexyz.txt" ^'s in my batch.
Unsure if this is an issue, I couldnt find any information on any limits to how many of those commands can be issues inside a single batch file.
I tried making sure there weren't any weird spaces anywhere but no matter what I did it always ended at the same 295th file. Even changing to a different file didn't change a single thing.

In my batch I
. 2024-08-27 11:37:28.229 Copying finished: Transferred: 9,705, Elapsed: 0:00:00, CPS: 85,131/s
> 2024-08-27 11:37:28.229 Script: ^
< 2024-08-27 11:37:28.229 Script: Unknown command '^'.
. 2024-08-27 11:37:28.229 Script: Failed
. 2024-08-27 11:37:28.230 Script: Exit code: 1
. 2024-08-27 11:37:28.232 Disconnected from server
I am on Windows 10 and my WinSCP Version is 6.3.4.

Reply with quote

Advertisement

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

Re: Batch File Ends After 295 File Transfers

Windows limit length of commandline to 8191 characters.
Command prompt line string limitation - Windows Client
You might have reached that.
In that case, you will have to either:
  • Simplify the command to "get file1.txt file2.txt file3.txt ... .\" ^ – but you might hit the limit sooner or later anyway
  • Split your commandline into several within the limit.
  • The best would be to move the commands to a script file, instead of passing them on the commandline. Use /script=... instead of /command for that. See https://winscp.net/eng/docs/commandline#scripting

Or you have some syntax problem in your batch file at the 295th file.
See https://winscp.net/eng/docs/faq_batch_file#newline_escaping

Reply with quote

Advertisement

You can post new topics in this forum