redundant mail account dirs - script to detect and delete?

spaceman

Well-Known Member
Mar 25, 2002
513
6
318
Hi All,

I'm looking at the mail dir for one of our hosting accounts:

/home/accname/,ail/domainname/

In there are lots of old dirs (with 2004 and 2003 dates next to them) that do not have a corresponding mail account as far as cPanel is concerned (mail > manage/add/remove accounts).

I can only assume that these old dirs / folders where not correctly deleted (for whatever reason) when the account was terminated via manage/add/remove accounts in cPanel.

I'm assuming that many of our hosting accounts might be affected by this problem, and therefore would like to tidy this up.

Short of going through every host accounts and making the comparison manually, does anyone know if there's a script that will (reliably!!) rip through a cPanel/WHM server, and auto-deleting any redundant mail dirs?

Thanks.