Too large user sytem email

brainfreeze

New member
Joined
Mar 4, 2013
Messages
2
I have a probelm with some of my user has a lot of mail in their system user inbox

And I found this topic
http://help.directadmin.com/item.php?id=433


--------------------------------
#!/bin/sh

#Deletes emails older than this number of days
OLD_THAN_DAYS=30

for i in `ls /usr/local/directadmin/data/users`; do
{
if [ ! -d /home/$i/Maildir ]; then
continue;
fi

rm -f `find /home/$i/Maildir -mtime +${OLD_THAN_DAYS} | grep -E '/cur/|/new/'`
};
done;
exit 0;

--------------------------------
when I ran the commnad it said
/bin/rm: Argument list too long

I think the inbox is too large to delete
has anybody has the same problem and how you fix the script ?

Thank you in advance ;)
 
Try this one:


Code:
#!/bin/sh
#Deletes emails older than this number of days
 OLD_THAN_DAYS=30

 for i in `ls /usr/local/directadmin/data/users`; do
 {
     if [ ! -d /home/$i/Maildir ]; then
           continue;
      fi

      for file in `find /home/$i/Maildir -mtime +${OLD_THAN_DAYS} | grep -E '/cur/|/new/'`; do
          rm -fv $file;
     done;
 };
 done;
exit 0;
 
thank you

Try this one:


Code:
#!/bin/sh
#Deletes emails older than this number of days
 OLD_THAN_DAYS=30

 for i in `ls /usr/local/directadmin/data/users`; do
 {
     if [ ! -d /home/$i/Maildir ]; then
           continue;
      fi

      for file in `find /home/$i/Maildir -mtime +${OLD_THAN_DAYS} | grep -E '/cur/|/new/'`; do
          rm -fv $file;
     done;
 };
 done;
exit 0;


Work great !!!

Thank you very much
 
Back
Top