I'm a bit unsure - how do you want to incorporate IF ELSE in a find command? Did you consider the -size test? You can have two (or more) branches in the find parameters. Read man find .
And, why and how do you differentiate between zero kB and empty?
Please be way more precise with your specification.
Also, you can stop at the first file; use 'read' or 'line' to detect the first line. Be careful of read, as "| read x' in ksh is fine, but in bash, read runs in an implicit subshell and x is not set for your shell, so try explicit subshell in which you test x: '|( read x ; . . . .)'. While 'line' is not a built-in (if you have it at all), it is good at expediting data out of a pipe, where one byte reads are given special treatment, do not block awaiting a bull buffer, and it returns 1 to $? on EOF.
until find /path/FTP. -type f -size 0 | awk '{print; exit 1}'
do
sleep 28800
done
Instead of until or while you can also use an if clause. It gets the exit status of the awk command, 0 normally, 1 if a zero-file was found.
NB in the shell an exit status 0 is a true condition (for practical reasons).
You can suppress awk's output with >/dev/null , this doesn't affect its exit status.
---------- Post updated at 02:57 PM ---------- Previous update was at 02:49 PM ----------
Just seeing the proposal with line .
while find /path/FTP. -type f -size 0 | line
do
sleep 28800
done