DIM $site $dir $file
$dir = "\\server\data\"
$site = "site1","site2","site3"
For Each $element In $site
$billingfile = $dir + $element + " " + "billing report" + ".csv"
$sizebill = GetFileSize($billingfile)
If ($sizebill > "0") and ($sizebill <= "1024")
? "$billingfile size is $sizebill"
Open(3, $billingfile) = 0
$x1 = ReadLine(3)
? "Line read: [" + $x1 + "]"
Close (3)
If InSTR($x1, "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||")
? "$billingfile file is empty and will be deleted"
DEL $billingfile
;? @SERROR
Else
? "$billingfile file is not empty"
EndIf
For Each $element In $site
$glfile = $dir + $element + " " + "ledger report" + ".csv"
$sizegl = GetFileSize($glfile)
If ($sizegl > "0") and ($sizegl <= "1024")
? "$glfile size is $sizegl"
Open(3, $glfile) = 0
$x2 = ReadLine(3)
? "Line read: [" + $x2 + "]"
Close (3)
If InSTR($x2, "|||||||||1")
? "$glfile file is empty and will be deleted"
DEL $glfile
;? @SERROR
Else
? "$glfile file is not empty"
EndIf
For Each $element In $site
$dxfile = $dir + $element + " " + "dx report" + ".csv"
$sizedx = GetFileSize($dxfile)
If ($sizedx > "0") and ($sizedx <= "1024")
? "$dxfile size is $sizedx"
Open(3, $dxfile) = 0
$x3 = ReadLine(3)
? "Line read: [" + $x3 + "]"
Close (3)
If InSTR($x3, "||||||1")
? "$dxfile file is empty and will be deleted"
DEL $dxfile
;? @SERROR
Else
? "$dxfile file is not empty"
EndIf