Topic "Check file size before uploading"

Author Message
alexsambi25
[View user's profile]

Joined: 2016-09-03
Posts: 1
Location: Oslo
The script working fine, but from now I need to check the file size before start uploading.

here is my codes.

Code:
@echo off

"C:\Program Files (x86)\WinSCP\winscp.com" ^
  /command ^
    "open sftp:// etc....^
    "put C:\fileput.xml /home/import/" ^
    "exit"


How I can make this codes to check the size C:\fileput.xml if the file size less than 100 MB so stop uploading.[/code]
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
See http://stackoverflow.com/questions/1199645/how-can-i-check-the-size-of-a-file-in-a-windows-batch-script

Though you can also abuse size-constraint in WinSCP file mask:

"put C:\fileput.xml -filemask=*>100K /home/import/" ^

See https://winscp.net/eng/docs/file_mask#size_time
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