Skip to main content

Batch mail deleting by date

Comments

6 comments

  • 24x7server
    Hi, You can use the find command in the particular directory to search it and remove it completely.. For example if you want to remove files older than 10 days, use below command: # find /path/to/files* -mtime +10 -exec rm {} \; You can alter the command as per your requirement to do this..
    0
  • teknom
    i search some dirs and got this dir for mails. i guess inbox mails are stored in /home/domainuser*/homedir/mail/domain.com*/mailuser*/cur directory. but these files does not have any extension. if i delete these files from this directory, does it cause any error? i mean these mail files indexed anywhere? mysql table or something else?
    0
  • teknom
    okay i got this, all mail files name includes my FQDN name and i find and print mails older than 90 days with this command. find /home/ -name '*mycpaneladress.com,S=*' -mtime +90 -print
    but i tried to add -exec rm {} \ command its not worked. no mails deleted. how can i combine this command with -exec ? ohh i forgot the semicolon. thats done thanks
    0
  • cPanelMichael
    Hello, I'm happy to see you were able to address the issue. As I understand, you wanted to remove all emails past a certain date, not just the ones in the "Trash" directory, however I do want to note the existence of the following feature in "WHM >> Mailserver Configuration": Auto Expunge Trash When this option is enabled, the system will remove messages in the Trash and Deleted Messages folders based on the expiration time configured in the option found below it. Thank you.
    0
  • teknom
    Thanks Michael i already use this feature but some of my clients storage their mails on inbox folder older than 2015. some mailboxes sized over GBs. actually, my problem is lower disk space. and i checked on backup files, the mail folders take up more spaces. therefor i find this solution :) any way for excluding mail folders on backup configuration?
    0
  • cPanelMichael
    any way for excluding mail folders on backup configuration?

    Hello, You can find a solution to this question at: Exclude mail folder from backup for all accounts Thanks!
    0

Please sign in to leave a comment.