Community Discussions and Support
Total number of trays, folders and emails

The number of folders, trays and emails have accumulate significantly over the 20+ years of PM usage. I wonder, is there a way to get a total count of the ones store locally(POP3)?


  • The number of lines in HIERARCH.PM would get me close to the number of trays and folders.
  • But where are the numbers of emails per folder stored (e.g. as displayed as toal:read)?

Any idea?
Thanks


The number of folders, trays and emails have accumulate significantly over the 20+ years of PM usage. I wonder, is there a way to get a total count of the ones store locally(POP3)? - The number of lines in HIERARCH.PM would get me close to the number of trays and folders. - But where are the numbers of emails per folder stored (e.g. as displayed as toal:read)? Any idea? Thanks

The number of lines in HIERARCH.PM would get me close to the number of trays and folders.


A search of the mailbox directory for *.PMM would give you an accurate count of the total number of folders.


But where are the numbers of emails per folder stored (e.g. as displayed as toal:read)?


CACHE.PM


[quote="pid:55098, uid:2273"]The number of lines in HIERARCH.PM would get me close to the number of trays and folders.[/quote] A search of the mailbox directory for *.PMM would give you an accurate count of the total number of folders. [quote="pid:55098, uid:2273"]But where are the numbers of emails per folder stored (e.g. as displayed as toal:read)?[/quote] CACHE.PM

Just looked, and there was a program called msgcount.exe, but don't think the site that had it no longer is active. In running it, it also seems that variables were too small since I get negative numbers .63ed4dbd7a261


Just looked, and there was a program called msgcount.exe, but don't think the site that had it no longer is active. In running it, it also seems that variables were too small since I get negative numbers .![63ed4dbd7a261](serve/attachment&path=63ed4dbd7a261)

mikes@guam.net

In a quick test I was able to get a quick approximation of message counts.
Seems the length of index entries are 118 bytes. (But that would include delete messages that have not had space recovered)
On my linux machine did a directory list of the PMI files.
ls -l *.PMI | cut -b34-200
Result is like
9794 Mar 5 2018 ACCOUNT.PMI
328984 Feb 14 06:41 AFT.PMI
2124 Mar 5 2018 ALUMNI.PMI
267506 Feb 15 21:53 AMAZON.PMI
272108 Jun 26 2022 AMZOLD.PMI
Imported into LibreOffice calc as fixed format to get 3 columns
deleted column B with date info.
Column C put =A1/118
At bottom put in row 98
A98:=sum(a1:a97)
B98:=counta(b1:b98 )
C98:=sum(c1:c98 )
12105738 97 102591


So, a quick process to get close info. Might be a field in PMM or PMI with count, but I didn't see it. Had a small folder with 83 messages, but didn't see that number in decimal or hex at beginning of files. PegFolders is another program but it doesn't give counts.


Copied data from PegFolders output into spreadsheet as tab delimited
Last two lines and sum of PMM files sizes then added Sum of PMI.
WEBCAL.PMM 5C8F36E1:170C:WEBCAL 2,285,097 WebCal
ZHAOPEI.PMM 25CC2EA6:27EF:ZHAOPEI 82,697,947 Zhaopei
2,907,960,515
Total Size PMM & PMI 2,920,066,253
.


In a quick test I was able to get a quick approximation of message counts. Seems the length of index entries are 118 bytes. (But that would include delete messages that have not had space recovered) On my linux machine did a directory list of the PMI files. ls -l *.PMI | cut -b34-200 Result is like 9794 Mar 5 2018 ACCOUNT.PMI 328984 Feb 14 06:41 AFT.PMI 2124 Mar 5 2018 ALUMNI.PMI 267506 Feb 15 21:53 AMAZON.PMI 272108 Jun 26 2022 AMZOLD.PMI Imported into LibreOffice calc as fixed format to get 3 columns deleted column B with date info. Column C put =A1/118 At bottom put in row 98 A98:=sum(a1:a97) B98:=counta(b1:b98 ) C98:=sum(c1:c98 ) 12105738 97 102591 So, a quick process to get close info. Might be a field in PMM or PMI with count, but I didn't see it. Had a small folder with 83 messages, but didn't see that number in decimal or hex at beginning of files. PegFolders is another program but it doesn't give counts. Copied data from PegFolders output into spreadsheet as tab delimited Last two lines and sum of PMM files sizes then added Sum of PMI. WEBCAL.PMM 5C8F36E1:170C:WEBCAL 2,285,097 WebCal ZHAOPEI.PMM 25CC2EA6:27EF:ZHAOPEI 82,697,947 Zhaopei 2,907,960,515 Total Size PMM & PMI 2,920,066,253 .

mikes@guam.net

Another option I just tired..
ls -l .PMM .PMI | cut -b34-200 | tr -s ' ' | cut -d\ -f2,6 >msgcount.txt


Using linux options to get size of files, and names of files.
Sure could be done in Windows as well.
Import msgcount.txt into spreadsheet.
In column C put formula =IF(RIGHT(B1,3)="PMI",A1/118,""smile
and copy down.
At bottom (in my case row 195)
Sum Column A and Column C
=counta(b1:b194)/2 in column B


248,508 ZHAOPEI.PMI 2,106
82,697,947 ZHAOPEI.PMM
2,920,066,253 97 102,591


Another option I just tired.. ls -l *.PMM *.PMI | cut -b34-200 | tr -s ' ' | cut -d\ -f2,6 >msgcount.txt Using linux options to get size of files, and names of files. Sure could be done in Windows as well. Import msgcount.txt into spreadsheet. In column C put formula =IF(RIGHT(B1,3)="PMI",A1/118,"") and copy down. At bottom (in my case row 195) Sum Column A and Column C =counta(b1:b194)/2 in column B 248,508 ZHAOPEI.PMI 2,106 82,697,947 ZHAOPEI.PMM 2,920,066,253 97 102,591

mikes@guam.net

Make a copy of CACHE.PM after Pegasus Mail shutdown
Open it with a spreadsheet program as a comma delimited file
Line count = total folders
Sum column D for total read messages
Sum column E for total unread messages
Sum both of those for total messages


The only thing you can't pull from this file is the number of trays.


@msetzerii, it would be interesting to compare your results with these.

Make a copy of CACHE.PM after Pegasus Mail shutdown Open it with a spreadsheet program as a comma delimited file Line count = total folders Sum column D for total read messages Sum column E for total unread messages Sum both of those for total messages The only thing you can't pull from this file is the number of trays. @msetzerii, it would be interesting to compare your results with these.

Did a little C program to do process without need for spreadsheet.
It doesn't do the unread option thou, but does do the total size.


Would need to figure out position for windows for start_size and start_filename.
Could modify program to pass values.


 #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#define START_SIZE 34 // Would be different for windows
#define START_FILENAME 57 // Would be different for windows
// With linux ls -l *.PMM *.PMI *.pmi *.pmm >msgx.txt [only output lines with those]
// -rw-rw-r--. 1 msetzerii msetzerii 9794 Mar 5 2018 ACCOUNT.PMI
// -rw-rw-r--. 1 msetzerii msetzerii 228030 Jan 19 14:15 ACCOUNT.PMM
// so position 34 is start of size and 57 is start of filename
// with windows need to do dir /-c *.pmm *.pmi >msgx.txt
// Not sure if all versions of Windows would use fixed locations??
// The /-c is necessary, since windows seems to default to have thousands separator.
// Also had to modify program to ignore lines without PMM or PMI since windows adds
// headers and totals...

using namespace std;

int main()
{
FILE *fp;
char temp[256],file_name[21];
long size_folder,msg_count=0,total_size=0,total_msg_count=0,folder_cnt=0;
int i;
system("clear"); // with windows would be system("cls") ;
fp = fopen("msgx.txt","r");
do
{
fgets(temp,200,fp);
if (feof(fp)) break;
sscanf(&temp[START_SIZE],"%ld",&size_folder);
sscanf(&temp[START_FILENAME],"%20[^\n]",file_name);
for(i=0;i<(int)strlen(file_name);i++) file_name[i]=toupper(file_name[i]);
if((strstr(file_name,".PMM")==NULL) && (strstr(file_name,".PMI")==NULL)) continue;
if(strstr(file_name,".PMI"))
{
msg_count=size_folder/118;
total_msg_count+=msg_count;
folder_cnt++;
}
total_size+=size_folder;
printf("%15ld %-20s %10ld\n",size_folder,file_name,msg_count);
} while (!feof(fp));
printf("%15ld %10ld %21ld\n",total_size,folder_cnt,total_msg_count);
fclose(fp);
return(0);
}
Did a little C program to do process without need for spreadsheet. It doesn&#039;t do the unread option thou, but does do the total size. Would need to figure out position for windows for start_size and start_filename. Could modify program to pass values. ```` #include &lt;cstdio&gt; #include &lt;cstdlib&gt; #include &lt;cstring&gt; #include &lt;string&gt; #define START_SIZE 34 // Would be different for windows #define START_FILENAME 57 // Would be different for windows // With linux ls -l *.PMM *.PMI *.pmi *.pmm &gt;msgx.txt [only output lines with those] // -rw-rw-r--. 1 msetzerii msetzerii 9794 Mar 5 2018 ACCOUNT.PMI // -rw-rw-r--. 1 msetzerii msetzerii 228030 Jan 19 14:15 ACCOUNT.PMM // so position 34 is start of size and 57 is start of filename // with windows need to do dir /-c *.pmm *.pmi &gt;msgx.txt // Not sure if all versions of Windows would use fixed locations?? // The /-c is necessary, since windows seems to default to have thousands separator. // Also had to modify program to ignore lines without PMM or PMI since windows adds // headers and totals... using namespace std; int main() { FILE *fp; char temp[256],file_name[21]; long size_folder,msg_count=0,total_size=0,total_msg_count=0,folder_cnt=0; int i; system(&quot;clear&quot;); // with windows would be system(&quot;cls&quot;) ; fp = fopen(&quot;msgx.txt&quot;,&quot;r&quot;); do { fgets(temp,200,fp); if (feof(fp)) break; sscanf(&amp;temp[START_SIZE],&quot;%ld&quot;,&amp;size_folder); sscanf(&amp;temp[START_FILENAME],&quot;%20[^\n]&quot;,file_name); for(i=0;i&lt;(int)strlen(file_name);i++) file_name[i]=toupper(file_name[i]); if((strstr(file_name,&quot;.PMM&quot;)==NULL) &amp;&amp; (strstr(file_name,&quot;.PMI&quot;)==NULL)) continue; if(strstr(file_name,&quot;.PMI&quot;)) { msg_count=size_folder/118; total_msg_count+=msg_count; folder_cnt++; } total_size+=size_folder; printf(&quot;%15ld %-20s %10ld\n&quot;,size_folder,file_name,msg_count); } while (!feof(fp)); printf(&quot;%15ld %10ld %21ld\n&quot;,total_size,folder_cnt,total_msg_count); fclose(fp); return(0); } ````

mikes@guam.net

If anyone interested. Modified program to use a single program do process info in both linux and windows environments.


Source Code
1549 Feb 17 09:08 msgzzz.cpp
g++ compiled for linux
15128 Feb 17 09:09 msgzzz
mingw compiled for windows
74752 Feb 17 09:09 msgzzz.exe


Now has process to get listings of files in MAIL directory.
Msg count can be off if folder contains deleted space.


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
// linux - ls -ln *.PMM *.PMI *.pmm *.pmi| tr -s ' ' | cut -f 5,9 -d' ' >PMMPMI.TXT
// windows - dir /-c *.pmm *.pmi>PMMPMI.TXT
// The /-c is necessary, since windows seems to default to have thousands separator.

using namespace std;

int main()
{
FILE *fp;
char temp[256],file_name[21];
long size_folder,msg_count=0,total_msg_count=0,folder_cnt=0;
long long total_size=0;
int i;
#ifdef __linux__
printf("\033[2J\033[1;1H"); // Linux clear screen ANSI codes
system("ls -ln *.PMM *.PMI *.pmm *.pmi| tr -s ' ' | cut -f 5,9 -d' ' >PMMPMI.TXT");
#else
system("cls"); // windows clear screen command
system("dir /-c *.pmm *.pmi>PMMPMI.TXT");
#endif
fp = fopen("PMMPMI.TXT","r");
do
{
fgets(temp,200,fp);
if (feof(fp)) break;
#ifdef __linux__
sscanf(temp,"%ld %20s",&size_folder,file_name);
#else
sscanf(&temp[20],"%ld %20s",&size_folder,file_name);
#endif
for(i=0;i<(int)strlen(file_name);i++) file_name[i]=toupper(file_name[i]);
if((strstr(file_name,".PMM")==NULL) && (strstr(file_name,".PMI")==NULL)) continue;
if(strstr(file_name,".PMI"))
{
msg_count=size_folder/118;
total_msg_count+=msg_count;
folder_cnt++;
}
total_size+=size_folder;
printf("%15ld %-20s %10ld\n",size_folder,file_name,msg_count);
} while (!feof(fp));
printf("%15lld %10ld %21ld\n",total_size,folder_cnt,total_msg_count);
fclose(fp);
remove("PMMPMI.TXT");
return(0);
}

I have all my folders renamed so folder names are close to nice names..


If anyone interested. Modified program to use a single program do process info in both linux and windows environments. Source Code 1549 Feb 17 09:08 msgzzz.cpp g++ compiled for linux 15128 Feb 17 09:09 msgzzz mingw compiled for windows 74752 Feb 17 09:09 msgzzz.exe Now has process to get listings of files in MAIL directory. Msg count can be off if folder contains deleted space. ```` #include &lt;cstdio&gt; #include &lt;cstdlib&gt; #include &lt;cstring&gt; #include &lt;string&gt; // linux - ls -ln *.PMM *.PMI *.pmm *.pmi| tr -s &#039; &#039; | cut -f 5,9 -d&#039; &#039; &gt;PMMPMI.TXT // windows - dir /-c *.pmm *.pmi&gt;PMMPMI.TXT // The /-c is necessary, since windows seems to default to have thousands separator. using namespace std; int main() { FILE *fp; char temp[256],file_name[21]; long size_folder,msg_count=0,total_msg_count=0,folder_cnt=0; long long total_size=0; int i; #ifdef __linux__ printf(&quot;\033[2J\033[1;1H&quot;); // Linux clear screen ANSI codes system(&quot;ls -ln *.PMM *.PMI *.pmm *.pmi| tr -s &#039; &#039; | cut -f 5,9 -d&#039; &#039; &gt;PMMPMI.TXT&quot;); #else system(&quot;cls&quot;); // windows clear screen command system(&quot;dir /-c *.pmm *.pmi&gt;PMMPMI.TXT&quot;); #endif fp = fopen(&quot;PMMPMI.TXT&quot;,&quot;r&quot;); do { fgets(temp,200,fp); if (feof(fp)) break; #ifdef __linux__ sscanf(temp,&quot;%ld %20s&quot;,&amp;size_folder,file_name); #else sscanf(&amp;temp[20],&quot;%ld %20s&quot;,&amp;size_folder,file_name); #endif for(i=0;i&lt;(int)strlen(file_name);i++) file_name[i]=toupper(file_name[i]); if((strstr(file_name,&quot;.PMM&quot;)==NULL) &amp;&amp; (strstr(file_name,&quot;.PMI&quot;)==NULL)) continue; if(strstr(file_name,&quot;.PMI&quot;)) { msg_count=size_folder/118; total_msg_count+=msg_count; folder_cnt++; } total_size+=size_folder; printf(&quot;%15ld %-20s %10ld\n&quot;,size_folder,file_name,msg_count); } while (!feof(fp)); printf(&quot;%15lld %10ld %21ld\n&quot;,total_size,folder_cnt,total_msg_count); fclose(fp); remove(&quot;PMMPMI.TXT&quot;); return(0); } ```` I have all my folders renamed so folder names are close to nice names..

mikes@guam.net

live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft