<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I have my spam-learning script which runs against all the folders that meet a criteria… however the parent directories share the same style…<div class=""><br class=""></div><div class="">So what I have is…</div><div class=""><br class=""></div><div class="">/var/mail/vhosts/domain.ltd/first.lastname/.folders{…}</div><div class=""><br class=""></div><div class="">The scan I have search for .Spam.New and .Spam.Suspected and runs those…</div><div class=""><br class=""></div><div class="">but I would like to scan through the entire structure and grab each first.lastname folder (it would be the *2nd* level of my scan as I have a half-dozen domains and will add more soon)…</div><div class=""><br class=""></div><div class="">That point behind it is I can scan specific folders as SPAM and any other folders (other than Inbox, Sent and Trash) as HAM.</div><div class=""><br class=""></div><div class="">So here’s my folder for this specific email address (<a href="http://cwis.biz" class="">cwis.biz</a>):</div><div class=""><font face="Courier New" class="">drwxrws--- 5 vmail spamd 4096 Oct 22 09:07 .Drafts<br class="">-rwxrwx--- 1 vmail spamd 0 Jan 21 2015 maildirfolder<br class="">drwxrws--- 5 vmail spamd 4096 Mar 19 2015 .Mailing Lists<br class="">drwxrws--- 5 vmail spamd 4096 Oct 22 05:49 .Mailing Lists.MySQL<br class="">drwxrws--- 5 vmail spamd 4096 Oct 15 16:44 .Mailing Lists.Nextdoor<br class="">drwxrws--- 5 vmail spamd 4096 Oct 17 09:38 .Mailing Lists.PFSense<br class="">drwxrws--- 5 vmail spamd 4096 Oct 22 07:38 .Mailing Lists.spamassassin<br class="">drwxrws--- 5 vmail spamd 4096 Oct 21 14:25 .Mailing Lists.TCLUG<br class="">drwxrws--- 5 vmail spamd 4096 Oct 21 12:59 .Mailing Lists.TCPHP<br class="">drwxrws--- 2 vmail spamd 16384 Oct 22 09:06 new<br class="">drwxrws--- 5 vmail spamd 4096 Jan 21 2015 .Notes<br class="">drwxrws--- 5 vmail spamd 4096 Oct 21 22:34 .Sent Messages<br class="">drwxrws--- 3 vmail spamd 4096 Oct 15 17:02 sieve<br class="">drwxrws--- 5 vmail spamd 4096 Oct 22 07:19 .Spam.New<br class="">drwxrws--- 5 vmail spamd 4096 Oct 22 07:25 .Spam.Scanned<br class="">drwxrws--- 5 vmail spamd 4096 Oct 22 09:06 .Spam.Suspected<br class="">drwxrws--- 5 vmail spamd 4096 Oct 22 09:06 .Spam.Tagged<br class="">-rwxrwx--- 1 vmail spamd 282 Oct 15 16:43 subscriptions<br class="">drwxrws--- 2 vmail spamd 4096 Oct 22 09:06 tmp<br class="">drwxrws--- 5 vmail spamd 4096 Oct 22 01:25 .Trash</font><br class=""><br class=""></div><div class="">Basically I want to get any folder that starts with “." inside of <i class="">/var/mail/vhosts/<a href="http://cwis.biz/ryan.coleman/" class="">cwis.biz/ryan.coleman/</a></i></div><div class=""><i class=""><br class=""></i></div><div class="">And then run the following commands:</div><div class=""><br class=""></div><div class=""><font face="Courier New" class="">/usr/bin/find /var/mail/vhosts/ -name '*.Spam.New*' -type d -exec /usr/bin/sa-learn --spam --progress {}* \;<br class="">/usr/bin/find /var/mail/vhosts/ -name '*.Spam.Suspected*' -type d -exec /usr/bin/sa-learn --spam --progress {}* \;<br class="">/bin/mv /var/mail/vhosts/<a href="http://cwis.biz/ryan.coleman/.Spam.New/cur/*" class="">cwis.biz/ryan.coleman/.Spam.New/cur/*</a> /var/mail/vhosts/<a href="http://cwis.biz/ryan.coleman/.Spam.Scanned/cur/" class="">cwis.biz/ryan.coleman/.Spam.Scanned/cur/</a><br class="">/bin/mv /var/mail/vhosts/<a href="http://cwis.biz/ryan.coleman/.Spam.New/new/*" class="">cwis.biz/ryan.coleman/.Spam.New/new/*</a> /var/mail/vhosts/<a href="http://cwis.biz/ryan.coleman/.Spam.Scanned/cur/" class="">cwis.biz/ryan.coleman/.Spam.Scanned/cur/</a></font></div><div class=""><div class=""><i class=""><br class=""></i></div><div class="">My regex-foo is not very good. I know there’s a way to do that with find(1) but I wouldn’t be able to wrap my head around it anyway.</div></div><div class=""><br class=""></div><div class="">TIA!</div><div class=""><br class=""></div><div class="">—</div><div class="">Ryan</div></body></html>