On Sat, 30 Aug 2014 08:23:02 -0600 LuKreme wrote: > if test -d "$J_PATH"; then > MYFIND=`find $J_PATH/ -type f -mtime -7|grep -v dovecot`
mtime may not be the best choice. Ideally what you want is the the time since the spam was moved to Junk, rather than the time since it was delivered. What I see with dovecot when I move mail with claws mail is that a new file is created with the mtime preserved at the delivery time and the current epoch time in the filename. In that case the ideal would be Btime if your OS supports it, or failing that ctime. You could also use the time in the filename. Note that epoch times are 10 digits until long after we're dead so simple lexicographical comparisons between maildir filenames or between a maildir filename and an epoch time will work. You may want to check what happens with whatever you use to move the spam. > if test -n "$MYFIND"; then > /usr/local/bin/sa-learn --spam -u ${i} $MYFIND #>/dev/null 2>&1 This may run into shell argument limits if you have to learn a lot of spam. Consider piping the output of find to xargs, or using -exec ...{} + in find.