Re: [Dovecot] OT: Counting emails in IMAP folders

2008-11-16 Thread Steffen Kaiser

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, 17 Nov 2008, Nigel Allen wrote:


We can do it over imap or on the server (FC6). They are using maildir.


With IMAP use the "EXISTS" info:

1 LOGIN user pwd
2 SELECT "Customers.Fred Jones"
* 1 EXISTS
..
3 SELECT "Customers.Fred Firestone"
* 6 EXISTS
...
n LOGOUT


On filesystem count the number of regular files in cur and new subdirs:

cd /path-to-maildir
for dir in .Customers.*; do
let cnt="$(ls "$dir/new"|wc -l) + $(ls "$dir/cur"|wc -l)"
# or: let cnt=$(find "$dir"/{cur,new} -type f|wc -l)
# compare cnt with last count
# you could store the value into "$dir/lastcnt"
done

Bye,

- -- 
Steffen Kaiser

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJISC5VJMDrex4hCIRAiW+AJ9jzfuqHp0jeM0MGvQjZMWk+lNangCfSYR7
5NXZ4O45BKzDn62dRPLFpq8=
=TK6c
-END PGP SIGNATURE-


Re: [Dovecot] OT: Counting emails in IMAP folders

2008-11-16 Thread Nigel Allen

Jose Celestino wrote:

Words by Nigel Allen [Mon, Nov 17, 2008 at 12:51:32PM +1100]:
  

Greetings

I have a customer who has mail server running dovecot with an IMAP  
account (Customers) which contains hundreds of folders (one per customer).


Looks like this:

Customers
   Fred Smith and Co
   Joe Blogss
   Cust-1
   Cust-n
  

They have a requirement to report monthly on the total number of emails  
added to each customers' folder during the month.


Basically I need to be able to run some kind of command line query that  
will give me each of the sub-folder names and the number of emails added  
to the folder for that month (or other user-specified time period).


Any ideas please?




Will do that over imap or on the filesystem? Are you using maildir,
mbox, dbox?
  

We can do it over imap or on the server (FC6). They are using maildir.

Rgds

Nigel.



Re: [Dovecot] OT: Counting emails in IMAP folders

2008-11-16 Thread Jose Celestino
Words by Nigel Allen [Mon, Nov 17, 2008 at 12:51:32PM +1100]:
> Greetings
>
> I have a customer who has mail server running dovecot with an IMAP  
> account (Customers) which contains hundreds of folders (one per customer).
>
> Looks like this:
>
> Customers
>Fred Smith and Co
>Joe Blogss
>Cust-1
>Cust-n
>   
>
> They have a requirement to report monthly on the total number of emails  
> added to each customers' folder during the month.
>
> Basically I need to be able to run some kind of command line query that  
> will give me each of the sub-folder names and the number of emails added  
> to the folder for that month (or other user-specified time period).
>
> Any ideas please?
>

Will do that over imap or on the filesystem? Are you using maildir,
mbox, dbox?

-- 
Jose Celestino | http://japc.uncovering.org/files/japc-pgpkey.asc

"One man’s theology is another man’s belly laugh." -- Robert A. Heinlein


[Dovecot] OT: Counting emails in IMAP folders

2008-11-16 Thread Nigel Allen

Greetings

I have a customer who has mail server running dovecot with an IMAP 
account (Customers) which contains hundreds of folders (one per customer).


Looks like this:

Customers
   Fred Smith and Co
   Joe Blogss
   Cust-1
   Cust-n
  

They have a requirement to report monthly on the total number of emails 
added to each customers' folder during the month.


Basically I need to be able to run some kind of command line query that 
will give me each of the sub-folder names and the number of emails added 
to the folder for that month (or other user-specified time period).


Any ideas please?

TIA

Nigel.