I am trying to write a kix script to read the first line in a pipe delimited csv file and delete the file if it contains the string "||||||". Basically, we have automated the running of crsytal report and their exports. If the report is empty, the automated process still saves the blank file, but the delimiters stay in the csv file. These blank files cause problems with the automated import, so I am trying to find a way to search for these files and delete them by a script. I can't seem to get this script working. Here is what I have so far:
 Code:
DIM $site $dir $file

$dir = "C:\temp\"
$site = "site1","site2","site3"
For Each $element in $site
$file = $dir + $element + " " + "report" + "\*.csv"
	If Open(3, $file)  = 0
	$x = Readline(3)
	? @serror
		IF INSTR($x, "|||||")
		@serror
		DEL $file
		? "file is empty"
	? @serror
		ELSE
	? "Data is not empty"
	? @serror
	Close (3)
	Endif


Any help would be appreciated. Thanks.