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