I have to write a script that will count the no of files in a directory in every 1sec.
for item in /d:/new_dir/*
do
if [ -f $item ]
then
FILECOUNT=$[$FILECOUNT+1]
fi
done
echo -e "No of files are $FILECOUNT\r\c";
FILECOUNT=0
sleep 1s
done
But I want to see which files were added or deleted between two iterations. Please tell me what modification do I need to change in the above code.