#1 (permalink)  
Old 04-06-2008, 10:53 PM
Registered User
 
Join Date: Feb 2004
Location: Montreal
Posts: 62
ramystyle
Lightbulb How to delete all mails on server older than X years..

Hi,

Is there a script for whm that deletes all mails older than XX years for all accounts on the server ?

Thanks !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-07-2008, 03:29 AM
WebScHoLaR's Avatar
Registered User
 
Join Date: Dec 2005
Location: Planet Earth
Posts: 473
WebScHoLaR is on a distinguished road
If the files haven't been accessed and have the older timestamp then you can delete the emails using find command.We will look for any files that are more than 2 years (2*365=730 days) old. A simpler command can be as but it needs to be further modified as per requirements.

find /home/*/mail -type f -mtime +730 | xargs rm -vf

You can set it as cron. Before running the command you should see what find command finds:

find /home/*/mail -mtime +730 > /home/emails.list
__________________

Regards,
WebScHoLaR


"If you want to travel around the world and be invited to speak at a lot of different places, just write a UNIX Operating System."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 03:51 PM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc