Hi,

On Mon, 24 May 2004 08:04:37 -0700 "David Groce" <[EMAIL PROTECTED]> wrote:

> I know it's not directly related to Spamassassin, but you folks are quite
> smart, so I thought I would see if you can see why my bash script doesn't
> seem to be cleaning out my spam.  The goal is to periodically clean out any
> messages that are older than 7 days.  Here it is.
> 
> #!/bin/sh
> 
> cd /home
> for i in */Maildir/.Spam ; do
>       find $i/{new,cur} -type f -mtime +7
> done | xargs -l -i rm -f
> 
> 
> The find part seems to ID all the older messages, but xargs doesn't seem to
> be removing them.  Any ideas?

Doesn't 'xargs -i' require that you specify the argument to the command
with '{}'? Do you get what you want if you do:

----
#!/bin/sh

cd /home
for i in */Maildir/.Spam ; do
        find $i/{new,cur} -type f -mtime +7
done | xargs -i rm -f {}
----

("-l1" is implied with the -i flag to xargs; -l is the same as "-l1"
so you should be able to drop -l entirely.)

>  Or a better approach?

Does this make a difference?

----
cd /home
for i in */Maildir/.Spam ; do
        find $i/{new,cur} -type f -mtime +7 -print | xargs -l25 rm -f
done
----

hth,

-- Bob

Reply via email to