I need a UNIX Kornshell (ksh) script that counts the number of files in directory. If the files exceed 20 files, then email results. I want the script to run every hour. I do not have access to cron. I am somewhat new to UNIX. Windows guy all my career. This is what I have so far..
#!/bin/ksh
# count.sh
while :
do
for dir in /directory1/
do
echo "$dir `du $dir |wc -l`"
done > ./message
mailx -s 'Dir Count' [email protected] < ./message
sleep 3600
done
Any help is greatly appreciated.