alexMar
November 15, 2008, 1:24am
1
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
alexMar
November 16, 2008, 7:31am
4
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 .
alexMar
November 16, 2008, 7:38am
5
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 .
alexMar
November 16, 2008, 7:50am
7
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.
alexMar
November 16, 2008, 10:27am
9
Could any body give me solution for the mailing part...
alexMar
November 16, 2008, 10:52am
10
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 .
alexMar
November 16, 2008, 12:14pm
11
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 >
alexMar
November 16, 2008, 12:52pm
12
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
alexMar
November 16, 2008, 12:54pm
13
the above one is not working..
Plz help me out