How to make sure dir is really empty

Hi,

I have this piece of shell script:

#!/bin/ksh

x[1]=data1
x[2]=data1
x[3]=data1

for i in 1 2 3
do
cp x [i]$IN_DIR
done
PerformNextTask

$IN_DIR is already designed to automatically pick up x [i]and send x [i]to other directory $OK_DIR. $IN_DIR will be empty once all x [i]goes to $OK_DIR. The speed of the pick up varies, sometimes x[1] takes 10 minutes to be sent to $OK_DIR, x[2] takes 2 minutes to go to $OK_DIR etc.

My problem is, - I want $IN_DIR to be fully emptied (last file x[3]) are picked up and sent to $OK_DIR then only I want to perform another task..

How can this be done?

I tried to do this :
if [`ls -l ${IN_DIR}` == "total 0" ]
then
PerformNextTask

but it's not working.

Can anybody out there help? :slight_smile:

I tried to do this :
if [`ls -l ${IN_DIR}` == "total 0" ]then
PerformNextTask
========================Try this instaed=================
if [`ls ${IN_DIR} |wc -l` == 0]

hey amitranjansahu..

your code works! thank you very much friend for your help :slight_smile: