Find transferred file size from Log

Advertisement

Mark Griffiths
Joined:
Posts:
1

Find transferred file size from Log

I have a text winscp log as follows

. 2020-03-07 10:01:31.776 --------------------------------------------------------------------------
. 2020-03-07 10:01:31.776 Using SFTP protocol.
. 2020-03-07 10:01:31.776 Doing startup conversation with host.
> 2020-03-07 10:01:31.776 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2020-03-07 10:01:33.370 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2020-03-07 10:01:33.370 SFTP version 3 negotiated.
. 2020-03-07 10:01:33.370 We believe the server has signed timestamps bug
. 2020-03-07 10:01:33.370 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2020-03-07 10:01:33.370 Getting current directory name.
. 2020-03-07 10:01:33.370 Getting real path for '.'
> 2020-03-07 10:01:33.370 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2020-03-07 10:01:33.370 Type: SSH_FXP_NAME, Size: 70, Number: 16
. 2020-03-07 10:01:33.370 Real path is '/sftp.[Redacted]'
. 2020-03-07 10:01:33.370 Startup conversation with host finished.
< 2020-03-07 10:01:33.370 Script: Active session: [1] [Redacted]
> 2020-03-07 10:01:33.370 Script: lcd "[Redacted]"
< 2020-03-07 10:01:33.370 Script: [Redacted]
> 2020-03-07 10:01:33.385 Script: put myFile.csv -nopreservetime
. 2020-03-07 10:01:33.385 Copying 1 files/directories to remote directory "[Redacted]" - total size: 61,938
. 2020-03-07 10:01:33.385 PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2020-03-07 10:01:33.385 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2020-03-07 10:01:33.385 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-03-07 10:01:33.385 Getting real path for '[Redacted]'
> 2020-03-07 10:01:33.385 Type: SSH_FXP_REALPATH, Size: 58, Number: 272
< 2020-03-07 10:01:33.385 Type: SSH_FXP_NAME, Size: 70, Number: 272
. 2020-03-07 10:01:33.385 Real path is '[Redacted]'
. 2020-03-07 10:01:33.385 File: 'myFile.csv' [2020-03-07T10:01:31.074Z] [61938]
. 2020-03-07 10:01:33.417 Copying "myFile.csv" to remote directory started.
. 2020-03-07 10:01:33.417 Binary transfer mode selected.
. 2020-03-07 10:01:33.417 Opening remote file.
> 2020-03-07 10:01:33.417 Type: SSH_FXP_OPEN, Size: 85, Number: 515
< 2020-03-07 10:01:33.557 Type: SSH_FXP_HANDLE, Size: 10, Number: 515
> 2020-03-07 10:01:33.557 Type: SSH_FXP_WRITE, Size: 32764, Number: 1030
. 2020-03-07 10:01:33.573 1 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2020-03-07 10:01:33.573 Type: SSH_FXP_CLOSE, Size: 10, Number: 1540
< 2020-03-07 10:01:33.588 Type: SSH_FXP_STATUS, Size: 32, Number: 1030
< 2020-03-07 10:01:33.588 Status code: 0
< 2020-03-07 10:01:33.588 Type: SSH_FXP_STATUS, Size: 32, Number: 1286
< 2020-03-07 10:01:33.588 Status code: 0
< 2020-03-07 10:01:33.667 Type: SSH_FXP_STATUS, Size: 32, Number: 1540
< 2020-03-07 10:01:33.667 Status code: 0
. 2020-03-07 10:01:33.667 Transfer done: 'myFile.csv' => '[Redacted]' [61938]
. 2020-03-07 10:01:33.667 Copying finished: Transferred: 61,938, Elapsed: 0:00:00, CPS: 267,853/s
> 2020-03-07 10:01:33.667 Script: exit
. 2020-03-07 10:01:33.667 Script: Exit code: 0
. 2020-03-07 10:01:33.667 Closing connection.
. 2020-03-07 10:01:33.667 Sending special code: 12
. 2020-03-07 10:01:33.667 Sent EOF message

Is it possible from this log to find the file size of myFile.csv that was transferred? I need to know whether the file was of minimal size (containing only one word) or normal size (containing a thousand or so rows).

Any help greatly appreciated. If there is any documentation on reading the logs, that also would be really helpful!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
32,896
Location:
Prague, Czechia

Re: Find transferred file size from Log

Do not try to interpret WinSCP session log file.

Use XML logging instead:
https://winscp.net/eng/docs/logging_xml

Or use WinSCP .NET assembly instead of plain scripting:
https://winscp.net/eng/docs/library

Anyway, the size of the file is in this mesage:
. 2020-03-07 10:01:33.667 Transfer done: 'myFile.csv' => '[Redacted]' [61938]

Your duplicate post on Stack Overflow:
https://stackoverflow.com/q/60600081/850848

Reply with quote

Advertisement

You can post new topics in this forum