how to execute unix commands within nzsql?
The documentation for nzsql states that to shell-out you just have to use blackslash pling, followed by the command:

\! command


If you need to know how to test for file size in a shell script, you can use something similar to:

if [[ -f $file ]] &amp;&amp; [[ -s $file ]]; then 
  echo "File exists and is greater than 0 bytes" ; 
  rm -f $file
fi


-f checks that it exists, -s checks if it's greater than 0 bytes.