-   Linux - Newbie (
-   -   find command give error file not found (

vishesh 05-27-2011 02:09 AM

find command give error file not found
find /var/spool/mqueue -group abc -exec rm -rf {} \;

Using above command , I delete all the files belong to group abc.

Now the problem i face is that the this command gives error that some files are missing . And this error occur because after creating list of files, it pass that list to rm -rf but till that time sendmail process queue and some of files disapper from /var/spool/mqueue.

Any suggestion to avoid this error message please ..

EricTRA 05-27-2011 02:41 AM


I had to look it up since I don't use sendmail, Postfix has the postuser command that takes care of things like you want to do. I think the best way to go is to stop the sendmail daemon first, clean up the queue and start the sendmail daemon again.

Kind regards,


EricTRA 05-27-2011 02:43 AM


Just came across this one on Google: How to clear sendmail queue

Kind regards,


vishesh 05-28-2011 06:37 AM

My question is not sendmail related . I know how to clean sendmail queue . I question is related to find command


EricTRA 05-28-2011 07:27 AM


You are of course entitled to have a different opinion. I only pointed you to the fact that you are using find to delete specific messages from the sendmail queue and that there are alternatives. I even told you that most likely if you stop the sendmail daemon before beginning the cleanup operation you'll not encounter that error. The find command passes the hits one after another to the rm command so it's not surprising that you encounter errors when running that on a mail queue that's active.

If you know how to clean up the sendmail queue then why are you insisting on using find to delete files from it when the daemon is active?

Kind regards,


networking.dept 05-28-2011 09:17 AM

Try by redirecting std error output to /dev/null

This is obvious thing that you are asking, while daemon is running then you are trying to execute this command then you'll see that kind of errors and its a obvious behaviour.

As per your questing, I feel that you don't want to see errors you only want to see success output right ? IF that so try following command :-

find /var/spool/mqueue -group abc -exec rm -rf {} \; 2> /dev/null

If you want to save that error output then you try following :-

find /var/spool/mqueue -group abc -exec rm -rf {} \; 2> error-output.txt

Hope this helps you.

All times are GMT -5. The time now is 10:14 AM.