I think my problem is with the usage of the rm command. Even when i execute it on its own (not within find) it fails to delete the file:

rm -f /home/vpopmail/domains/domain.com/nick/Maildir/.Junk E-mail/cur/*

Executes with no error and fails to delete the contents of the directory. Could this simply then be due to the fact that rm will not delete files in a folder using * unless you are currently inside that directory?

Nicholas Payne-Roberts wrote:
nope, that didn't have any effect either :(

I've tried with -v option but that doesn't show me anything else going on either.

Thanks for your suggestions though Sietse.

Sietse van Zanen wrote:
Just a thought, try escapeing the *
find /home/vpopmail/domains -name ".Junk E-mail" -exec rm -f {}/cur/\* \;

Maybe that helps.
-Sietse
________________________________

From: Nicholas Payne-Roberts [mailto:[EMAIL PROTECTED]
Sent: Wed 12-Jul-06 15:12
To: Sietse van Zanen
Subject: Re: spam script



find /home/vpopmail/domains -name ".Junk E-mail" -exec rm -f {}/cur/* \;

It just seems to execute without any errors but when you look in any of
the cur directories, the files are still there:

 find /home/vpopmail/domains -name ".Junk E-mail" -exec ls -l {}/cur \;
total 0
total 0
total 0
total 0
total 0
total 0
total 0
total 0
-rw-r--r--  1 root root 0 Jul 12 16:09 test          <------ a touch'd
file i just placed into a cur directory to test the rm command.


Sietse van Zanen wrote:
I thought that was what you wanted.

Otherwise I would expect the original command with * to be working well in removing the files in the ../cur directory. What's going wrong with that than?

-Sietse

________________________________

From: Nicholas Payne-Roberts [mailto:[EMAIL PROTECTED]
Sent: Wed 12-Jul-06 14:55
To: users@spamassassin.apache.org
Subject: Re: spam script



That deleted all of the cur directory within the .Junk E-mail directory.

Sietse van Zanen wrote:
Loose the * and do rm -rf (recursively deletes the directory)

-Sietse

________________________________

From: Nicholas Payne-Roberts [mailto:[EMAIL PROTECTED]
Sent: Wed 12-Jul-06 14:24
To: users@spamassassin.apache.org
Subject: spam script



I am now trying to figure out how to use find in a similar way to tidy
up those Junk E-mail directories by deleting them after they have been
used to learn from. This is what i've tried, but the rm command doesn't
seem to like working with files within the /cur directory...

find /home/vpopmail/domains -name ".Junk E-mail" -exec rm -f {}/cur/* \;

If i try the above and omit the astrix, it complains about cur being a
directory:

rm: cannot remove `/home/vpopmail/domains/domain.com/nick/Maildir/.Junk
E-mail/cur/': Is a directory

Thanks in advance for any suggestions :)

Nick

Chris Lear wrote:

* Nicholas Payne-Roberts wrote (11/07/06 11:58):
Does anybody know a good way to script sa-learn to daily check on
junk e-mail folders? i'm currently trying the following line in a
cron.daily script, but its throwing up an error:

find /home/vpopmail/domains -name ".Junk E-mail" -exec  sa-learn
--showdots --spam cur {} \;
Your --exec subcommand is the problem. The {} expands to the full path
of the found file. It doesn't change directory. A version that might
work is

find /home/vpopmail/domains -name ".Junk E-mail" -exec  sa-learn
--showdots --spam {}/cur \;

There's not much point using --showdots in cron, I would have thought,
but it's probably useful for testing.

To make sure your find command is right, you can do something like this:

find /home/vpopmail/domains -name ".Junk E-mail" -exec echo "sa-learn
--showdots --spam {}/cur" \;

which will simply echo a list of commands that would get executed.

Chris


Reply via email to