Scripting related .

Could any body give the solution/script to get the below...

1.script will run and detcect the files having 0kb size , and give the solution in a out put file.(Will search the file in the path let say /abc/M/)

2.Same as the above also send a mail to your mails id , with the file name stating that the file is of 0kb size ..

Giving the solution to the above and for the second one will be highly appriciated..

We want to help you if you have shown that you have put some effort into solving your own problem but not to do your work for you.
What have you attempted so far and where do you get stuck?

Regards

You can use find command to find the files with zero size in a path
UNIX man pages : find ()

And to send mail you can use mailx or sendmail

Linux and UNIX sendmail command help

thanks for your reply...

Find for that like..

find /abc/M/ -name '*.txt' | xargs ls -l | awk '{print $5 , $9}' > myoutfile.txt

result will come to myoutfile.txt like the file having size 0 showing me like the file size and file name.

now point is same thing i need to come to me through mail also.let say my mail it alexmar@My.com.

it will be great any body can give idea on this...

i want the result part of the find will send to my mail..
what ever result will come to myoutfile will also come to mail box at the same time with same result stating the same.

Please don't bump up questions! Read the rules.

sorry frank...

could you please help me out on the mailing part solution.

Search at this forum for send file mail, and you'll get a bunch of threads regarding this item.

Could any body give me solution for the mailing part...

Frank i got some idea..

could you plz give me sme solution to the below...

find /abc/M/ -name '*.txt' | xargs ls -l | awk '{print $5 , $9}' > myoutfile.txt

result will come to myoutfile.txt like the file having size 0 showing me like the file size and file name.

now once the above comand get any 0 kb file will put it in myoutfile.txt and simultaneously send the file to alexmar@My.com.

please help me out..

i want the above result to send to my mail accont..

myoutfile.txt to alexmar@My.com.

plz let me know the synatx after this to get the thing in mail...

find /abc/M/ -name '*.txt' | xargs ls -l | awk '{print $5 , $9}' > myoutfile.txt

<Syntax need to send the myoutfile.txt to alexmar@My.com>

FILES=`find /abc/M/ -name '*.txt' | xargs ls -l | awk '{print $5 , $9}' > myoutfile.txt`
if [[ -n "${FILES}" ]]; then
echo "Hey, I found some files !" |\
mail -s 'Files !' you@domain.org
else
echo "check the file"
fi
exit 0

the above one is not working..
Plz help me out

any idea on this.