some files are not getting uploaded

Advertisement

nezar
Joined:
Posts:
5

some files are not getting uploaded

Hello,

I have a batch file that runs every 5 minutes to upload a batch of .txt files to only one server. From time to time, I notice that sometimes not all files are uploaded in a single transfer!

For example, i had a batch of 19 txt files, 18 of them get uploaded. Only one of them didn't! And no error was generated. as if though it has skipped the files.

in the attached log file, you will notice that 18 files were uploaded successfully, but 19 files were deleted from the SFTP server. Tha means that one file was not uploaded!
the file name is: DRLL-SAL-25102018-14.txt

what could be the reason? how to resolve the issue?

WinSCP 5.11.3
Protocol SFTP, port 22
Local machine:
OS Name: Microsoft Windows Server 2012 R2
Using scripting/automation.


The batch file flow is as follows:
1- connect to SFTP server.
2- change local directory.
3- transfer all .txt files.
4- Delete all files from SFTP server.

please check the contents of my batch file:
Batch file content:

@echo off
CD "C:\Program Files (x86)\WinSCP"
Winscp.com /log="\\dfs1\root\loc_Apps\WinSCP_Log\b2b_upload.txt" /logsize=10*100M /ini=nul /script=E:\B2B_job\uploadscript.txt

uploadscript.txt content:

option echo off
option batch on
option confirm off
open sftp://b2bsal_dfs:file@X.X.X.X/ -hostkey="ssh-rsa 2048 ea:e2:15:f7:gh:27:65:ad:87:45:3c:9e:4c:e8:a5:b8"
lcd //dfs1/root/Shared3/B2B_SAL
get -nopreservetime -nopermissions -resumesupport=on *
rm *
exit

Reply with quote

Advertisement

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

Re: some files are not getting uploaded

You seem to mix up "download" and "upload". I'm going to assume that you mean "download" everytime.

The file was probably created only after the get command started (but before the rm command stated). So it was not downloaded, but was deleted.

To do "download and delete" in a transactional way (only delete the files that were downloaded), use -delete switch of the get command (and remove the rm command):

lcd //dfs1/root/Shared3/B2B_SAL
get -delete -nopreservetime -nopermissions -resumesupport=on *
exit

https://winscp.net/eng/docs/scriptcommand_get#delete

Reply with quote

Advertisement

You can post new topics in this forum