How to not ftp a file if the file size is <1K

Advertisement

petant
Guest

How to not ftp a file if the file size is <1K

I am using verison 5.1.7.

The goal is to not PUT a file on an FTP server if the file is a size 0 text file which has no data.

I have found your documentation online where you state I can use the following:

"size[KMG] Matches files smaller than size. <1K "

I am not sure exactly where to put this matching code. Do I use the <1K on the PUT command?

If I don't want to PUT a file if it is less than 0K do I use <0K?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: How to not ftp a file if the file size is <1K

Use put * -filemask=*>1K /target/path/ to upload all files larger than 1 KB.

See https://winscp.net/eng/docs/file_mask#size_time

If I don't want to PUT a file if it is less than 0K do I use <0K?
That does not make sense. A file cannot have a negative size (less than 0).

Last edited by martin on 2015-03-25; edited 1 time in total

Reply with quote

petant
Guest

I have tried the recommended approach but it's not working. I don't get an error. It just seems to stop.

Here is the script that I am running:

option batch abort
option confirm off
open "ftp://bla-bla-bla" -explicitssl -certificate="xyz"
lcd N:\Data
put 57-1-104352.txt >1K
put 57-1-104354.txt >1K
put 57-5-105442.txt >1K
put 57-8-106914.txt >1K
put 57-169-143038.txt >1K
close
exit

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Sorry, my answer was wrong. I've corrected it.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum