Avoiding 0 kb files using (get -delete)

Advertisement

TOYO
Guest

Avoiding 0 kb files using (get -delete)

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.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Re: Avoiding 0 kb files using (get -delete)

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

_________________
Martin Prikryl

Reply with quote

TOYO
Guest

Re: Avoiding 0 kb files using (get -delete)

martin wrote:

You should be able to exclude empty files with:
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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Re: Avoiding 0 kb files using (get -delete)

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

Reply with quote

Advertisement

You can post new topics in this forum