0 byte file transmitted from SFTP folder, using WinSCP to download

Advertisement

tiesteaz
Joined:
Posts:
2

0 byte file transmitted from SFTP folder, using WinSCP to download

Hello,

Failure I've got
Today I got failure due to 0 Byte file synchronized from SFTP using WinSCP, details below
Question:
How to make sure that I am downloading only files that finished uploading?
Who needs to make a change - me or my partner who uploads the file?

My business scenario
There is SFTP folder maintained under CerberusFTP server with two users to manage file upload and download:
edi_upload - this user uploads file to SFTP folder using unknown software (it is used by my partner)
edi_download - this file downloads file from SFTP folder using WinSCP

My WinSCP script
To download file under edi_download I'm using following WinSCP script:
# Download incoming files
get -delete /EDI/02046397/in/* D:\EDIPartners\02046397\in\

Below is the log of the transmission with my comments

Here's where edi_upload is connecting to transmit file 850_POS-1-20200331153633.xml132301574591238060.xml

[2020-03-31 22:44:18]:CONNECT [ 13006] - Native user 'edi_upload' authenticated
[2020-03-31 22:44:18]:CONNECT [ 13006] - Channel Open: 'session', Sender Channel: 256, Init Window Size: 2147483647, Max Packet Size: 16384
[2020-03-31 22:44:18]:CONNECT [ 13006] - Creating local channel: 207280
[2020-03-31 22:44:18]:CONNECT [ 13006] - Channel Request: 'simple@putty.projects.tartarus.org', Recipient Channel: 207280, Subsystem Name: '', Reply: false
[2020-03-31 22:44:18]:CONNECT [ 13006] - Channel Request: 'subsystem', Recipient Channel: 207280, Subsystem Name: 'sftp', Reply: true
[2020-03-31 22:44:18]:COMMAND [ 13006] - Client SFTP version: 6
[2020-03-31 22:44:18]:COMMAND [ 13006] - Real Path for '.'
[2020-03-31 22:44:19]:COMMAND [ 13006] - Real Path for '/EDI/02046397/in/'
[2020-03-31 22:44:19]:CONNECT [ 13007] - Incoming connection request on SSH SFTP interface 0 at X.X.X.X:22 accepted from X.X.X.X:61830
[2020-03-31 22:44:19]:   INFO [ 13007] - Client Identification: SSH-2.0-WinSCP_release_5.15.1
[2020-03-31 22:44:19]:CONNECT [ 13007] - Algorithm negotiation complete: Proceeding with key exchange
[2020-03-31 22:44:19]:CONNECT [ 13007] - Kex: 'ecdh-sha2-nistp256' Host Key: 'ssh-rsa' C2S : 'aes256-ctr, hmac-sha2-256, none' S2C : 'aes256-ctr, hmac-sha2-256, none'

Here is where file upload starts

[2020-03-31 22:44:19]:COMMAND [ 13006] - File open command received for '/EDI/02046397/in/850_POS-1-20200331153633.xml132301574591238060.xml' requesting WRITE,CREATE TRUNC
[2020-03-31 22:44:19]: SYSTEM [ 13006] - File handle to '/EDI/02046397/in/850_POS-1-20200331153633.xml132301574591238060.xml' opened

Here is where edi_download user started downloading the file

[2020-03-31 22:44:19]:CONNECT [ 13007] - Authenticating password for user 'edi_download'
[2020-03-31 22:44:19]:CONNECT [ 13007] - Native user 'edi_download' authenticated
[2020-03-31 22:44:19]:CONNECT [ 13007] - Channel Open: 'session', Sender Channel: 256, Init Window Size: 2147483647, Max Packet Size: 16384
[2020-03-31 22:44:19]:CONNECT [ 13007] - Creating local channel: 207296
[2020-03-31 22:44:19]:CONNECT [ 13007] - Channel Request: 'simple@putty.projects.tartarus.org', Recipient Channel: 207296, Subsystem Name: '', Reply: false
[2020-03-31 22:44:19]:CONNECT [ 13007] - Channel Request: 'subsystem', Recipient Channel: 207296, Subsystem Name: 'sftp', Reply: true
[2020-03-31 22:44:19]:COMMAND [ 13007] - Client SFTP version: 6
[2020-03-31 22:44:19]:COMMAND [ 13007] - Real Path for '.'
[2020-03-31 22:44:19]:COMMAND [ 13007] - Opening directory handle to '/EDI/02046397/in'
[2020-03-31 22:44:19]: SYSTEM [ 13007] - Directory handle '/EDI/02046397/in' closed
[2020-03-31 22:44:19]:COMMAND [ 13007] - File open command received for '/EDI/02046397/in/850_POS-1-20200331153633.xml132301574591238060.xml' requesting READ,OPEN/CREATE
[2020-03-31 22:44:19]: SYSTEM [ 13007] - File handle to '/EDI/02046397/in/850_POS-1-20200331153633.xml132301574591238060.xml' opened
[2020-03-31 22:44:19]:COMMAND [ 13007] - FStat : /EDI/02046397/in/850_POS-1-20200331153633.xml132301574591238060.xml
[2020-03-31 22:44:19]: SYSTEM [ 13007] - Download started for file 'E:\FtpRoot\EDI\02046397\in\850_POS-1-20200331153633.xml132301574591238060.xml'

Here is where the issue occurred - see the first line of the log snippet below:
[2020-03-31 22:44:19]: SYSTEM [ 13007] - Successfully sent file 'E:\FtpRoot\EDI\02046397\in\850_POS-1-20200331153633.xml132301574591238060.xml' (0 B sent)

[2020-03-31 22:44:19]: SYSTEM [ 13007] - Successfully sent file 'E:\FtpRoot\EDI\02046397\in\850_POS-1-20200331153633.xml132301574591238060.xml' (0 B sent)
[2020-03-31 22:44:19]: SYSTEM [ 13007] - Handle '/EDI/02046397/in/850_POS-1-20200331153633.xml132301574591238060.xml' closed
[2020-03-31 22:44:19]:COMMAND [ 13007] - Remove file '/EDI/02046397/in/850_POS-1-20200331153633.xml132301574591238060.xml'
[2020-03-31 22:44:19]:   INFO [ 13007] - File 'E:\FtpRoot\EDI\02046397\in\850_ POS-1-20200331153633.xml132301574591238060.xml' successfully deleted

[2020-03-31 22:44:19]:COMMAND [ 13007] - Real Path for '/EDI/02046397/out/'
[2020-03-31 22:44:19]:COMMAND [ 13007] - Opening directory handle to '/EDI/02558414/in'
[2020-03-31 22:44:19]: SYSTEM [ 13007] - Directory handle '/EDI/02558414/in' closed
[2020-03-31 22:44:19]:COMMAND [ 13007] - Real Path for '/EDI/02558414/out/'
[2020-03-31 22:44:19]:   INFO [ 13007] - Received EOF on channel '207296'
[2020-03-31 22:44:19]:CONNECT [ 13007] - Sending EOF for channel '256'
[2020-03-31 22:44:19]:CONNECT [ 13007] - Sending Close for channel '256'
[2020-03-31 22:44:19]:CONNECT [ 13007] - Channel '207296' removed
[2020-03-31 22:44:19]:CONNECT [ 13007] - The client closed the connection
[2020-03-31 22:44:19]:CONNECT [ 13007] - Connection terminated

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
33,846
Location:
Prague, Czechia

Re: 0 byte file transmitted from SFTP folder, using WinSCP to download

You can download only files older than certain time interval, like 5 minutes:

get -delete /EDI/02046397/in/*<5N D:\EDIPartners\02046397\in\

For a general discussion of the topic, see:
https://stackoverflow.com/q/43848774/850848

Reply with quote

Advertisement

You can post new topics in this forum