Page 1 of 1 1
Topic Options
#317 - 1999-08-22 04:41 AM detecting file size...
Anonymous
Unregistered


Hi
I have a script the opens the backup log and exits with the sucess statement on line 5
; open log and readline until counter = 5 then exit
$count3 = 0
Open(3, "c:\scripts\logs\backup.log")
while $count3 <> 5
$date = ReadLine(3)
$count3 = $count3 + 1
loop
close(3)
? "Date: " $date
BUT, if the backup fails it writes an empty log with null data, this puts readline into a
spin, how can I detect the file has nill data? can kix work out its file size?
if $size < 4000 then backup has failed?

thanks
john@myplace.co.nz

------------------
------------------------
John Hornblow
Wellington New Zealand
johnhb@paradise.net.nz
------------------------

Top
#318 - 1999-08-23 09:12 AM Re: detecting file size...
Anonymous
Unregistered


John,

How about checking to see if the file is first valid by reading the first line before the loop starts? If it returns an expected response then continue. If it returns null, then don't bother with the loop.

../mk

Top
#319 - 1999-08-24 12:49 AM Re: detecting file size...
Anonymous
Unregistered


bit it just goes into a spin...
sits there doing nothing, doent even give an error coded...

Top
#320 - 1999-09-01 08:59 AM Re: detecting file size...
Anonymous
Unregistered


If the failure is generating a zero-byte file, perhaps you could use GetFileSize as an initial check:

$size = GetFileSize("c:\scripts\logs\backup.log")
if $size = 0
exit
else
[...]
endif

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1343 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.039 seconds in which 0.019 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org