Topic "put command file size"

Author Message
dev_toor

Guest


When using "put" command to upload a file w/ the size less than 1 Kilobyte(1024 bytes), it shows 0 KiB (in red). Is there any switch/option to display that in bytes?

winscp> put licence.txt
licence.txt | 0 KiB | 0.0 KiB/s | binary | 100%

winscp> stat licence.txt
-rw-rw-r-- 0 46 Dec 27 14:47:41 2012 licence.txt
dev_toor

Guest


After looking into documentation and source code, looks like there is no switch/option to display transferred size in bytes for size less than 1024 bytes.

I believe the following should do it. Please let me know if this can be considered an enhancement and build into future release.

Before:
Code:

        UnicodeString ProgressMessage = FORMAT(L"%-*s | %10d KiB | %6.1f KiB/s | %-6.6s | %3d%%",
          (WidthFileName, FileName,
           static_cast<int>(ProgressData.TransferedSize / 1024),
           static_cast<float>(ProgressData.CPS()) / 1024,
           ProgressData.AsciiTransfer ? L"ascii" : L"binary",
           ProgressData.TransferProgress()));


After:
Code:

        UnicodeString ProgressMessage;
        if(ProgressData.TransferedSize < 1024)
        {
          ProgressMessage = FORMAT(L"%-*s | %10d Byte(s) | %6.1f KiB/s | %-6.6s | %3d%%",
          (WidthFileName, FileName,
           static_cast<int>(ProgressData.TransferedSize),
           static_cast<float>(ProgressData.CPS()) / 1024,
           ProgressData.AsciiTransfer ? L"ascii" : L"binary",
           ProgressData.TransferProgress()));
        }
        else
        {
          ProgressMessage = FORMAT(L"%-*s | %10d KiB | %6.1f KiB/s | %-6.6s | %3d%%",
          (WidthFileName, FileName,
           static_cast<int>(ProgressData.TransferedSize / 1024),
           static_cast<float>(ProgressData.CPS()) / 1024,
           ProgressData.AsciiTransfer ? L"ascii" : L"binary",
           ProgressData.TransferProgress()));
        }
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Duplicate post:
http://winscp.net/forum/viewtopic.php?t=11999
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License