Topic "Avoiding 0 kb files using (get -delete)"

Author Message
TOYO

Guest


Hello WinSCP scripting guru!

I am using a following script to get xml files from FTP server to a local folder on one of the servers on the perimeter network.

option batch on
option confirm off"
open ftp://ftpname:password@xx.xxx.xxx.xxx
cd EXAM\IN
option transfer binary
get -delete 1122result_*.xml \\servername\data\FTP\
close
exit

The script is working, getting file by file from FTP and deleting pulled file on FTP.
The files on FTP are pushed by a third party vendor with a real time schedule.
Sometimes i am getting 0 kb files from FTP because script starts the same time vendor pushed the file. Because script deleting file by file right after GET, i can't use a masking for the file size.

How to accomplish the same logic (get file by file with delete option on FTP) but avoid a 0 kb files?

Thank you so much,

Youre TOYO.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You should be able to exclude empty files with:
Code:
option exclude <1

_________________
Martin Prikryl
TOYO

Guest


prikryl wrote:
You should be able to exclude empty files with:
Code:
option exclude <1


prikryl, the "option exclude <1" ignoring by "get -delete".

The "exclude" and "include" options working only (not with -delete).
Do you have an alternative to this solution?

Youre TOYO.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You are right, I've forgot about this.

Well, you can enable XML logging, use just "get" then parse the XML log to see what file got downloaded and generate another script to delete those files.

See this example script (for completely different task), which shows you how to parse the XML log to get filenames and how to generate script.
_________________
Martin Prikryl
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