<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.3">
</HEAD>
<BODY>
<BR>
On Fri, 2010-01-15 at 08:39 -0500, James B. Byrne wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">I run cyrus-imapd under CentOS-4.8 (a RedHat el4 clone). I am</FONT>
<FONT COLOR="#000000">trying to discover if there is any way to purge a user's INBOX of</FONT>
<FONT COLOR="#000000">old and over-sized messages without affecting the contents of any</FONT>
<FONT COLOR="#000000">subfolders thereof.</FONT>
<FONT COLOR="#000000">I have looked at impurge as the mechanism. However,my reading of the</FONT>
<FONT COLOR="#000000">man page, and of online discussions relating to this matter,</FONT>
<FONT COLOR="#000000">indicate that in order for impurge to remove any mail from the INBOX</FONT>
<FONT COLOR="#000000">then the -f switch has to be passed. But, I also gather that</FONT>
<FONT COLOR="#000000">whenever the -f switch is used then ALL subfolders of the target</FONT>
<FONT COLOR="#000000">directory are purged recursively as well.</FONT>
<FONT COLOR="#000000">This strikes me as a rather odd combination of attributes but I</FONT>
<FONT COLOR="#000000">cannot see any way to prevent recursion if the -f switch is used. </FONT>
<FONT COLOR="#000000">What is the recommended way to purge mail from a user's INBOX only</FONT>
<FONT COLOR="#000000">using criteria such as age and size?</FONT>
<FONT COLOR="#000000">Sincerely,</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
I think you mean ipurge (not impurge) <BR>
Even I had exactly the same issue .. I modified ipurge.c a bit so that it will expect a "-r" switch to recurse through subfolders<BR>
along with "-f"<BR>
else "-f" works only on the inbox<BR>
<BR>
I have a workaroud patch to ipurge.c I can share .. but *absolutely no guarantee* that it will work for you <BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<FONT SIZE="2">--- ipurge.c.default 2006-01-21 18:50:26.000000000 +0530 </FONT><BR>
<FONT SIZE="2">+++ ipurge.c 2006-01-21 18:50:34.000000000 +0530 </FONT><BR>
<FONT SIZE="2">@@ -85,6 +85,8 @@ </FONT><BR>
<FONT SIZE="2">int skipflagged = 0; </FONT><BR>
<FONT SIZE="2">int datemode = OFFSET_SENTDATE; </FONT><BR>
<FONT SIZE="2">int invertmatch = 0; </FONT><BR>
<FONT SIZE="2">+short int recurse =0; </FONT><BR>
<FONT SIZE="2">+short int done=0; </FONT><BR>
<BR>
<FONT SIZE="2">/* for statistical purposes */ </FONT><BR>
<FONT SIZE="2">typedef struct mbox_stats_s { </FONT><BR>
<FONT SIZE="2">@@ -159,6 +161,9 @@ </FONT><BR>
<FONT SIZE="2">case 'i' : { </FONT><BR>
<FONT SIZE="2">invertmatch = 1; </FONT><BR>
<FONT SIZE="2">} break; </FONT><BR>
<FONT SIZE="2">+ case 'r' : { </FONT><BR>
<FONT SIZE="2">+ recurse = 1; </FONT><BR>
<FONT SIZE="2">+ } break; </FONT><BR>
<FONT SIZE="2">case 'h': </FONT><BR>
<FONT SIZE="2">default: usage(argv[0]); </FONT><BR>
<FONT SIZE="2">} </FONT><BR>
<FONT SIZE="2">@@ -234,6 +239,10 @@ </FONT><BR>
<FONT SIZE="2">if (!strncasecmp(name,"INBOX",5) || mboxname_isusermailbox(name, </FONT><BR>
<FONT SIZE="2">0)) </FONT><BR>
<FONT SIZE="2">return 0; </FONT><BR>
<FONT SIZE="2">} </FONT><BR>
+if(!recurse){<BR>
<FONT SIZE="2">+ if(done) return(0); </FONT><BR>
<FONT SIZE="2">+ done=1; </FONT><BR>
<FONT SIZE="2">+ }</FONT><BR>
<FONT SIZE="2">+</FONT><BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>