put command file size

Advertisement

dev_toor
Guest

put command file size

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

Reply with quote

Advertisement

dev_toor
Guest

Re: put command file size

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:
        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:
        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()));
        }

Reply with quote

Advertisement

You can post new topics in this forum