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>
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");
system("ls -ln *.PMM *.PMI *.pmm *.pmi| tr -s ' ' | cut -f 5,9 -d' ' >PMMPMI.TXT");
#else
system("cls");
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 <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..