How to Selecting all emails except for specific ones?


Jun 23, 2022
cPanel Access Level
Root Administrator
I have a code which selects all emails that start with "scan" and delete the sent emails in the folder that are a day or more older as seen below

find /home/admin/mail/*/.Sent -type f -mtime +1 -exec rm {} \;

I want to be able to now the Select all emails in my domain except for the ones that start with "scan" but I do not know how to add the exception code or work it out where it can select other emails except for those ones.

Any help would be appreciated.

Thank you.
Last edited by a moderator:


Jurassic Moderator
Staff member
Oct 19, 2014
cPanel Access Level
Root Administrator
Hey there! This is more a question about regex on Linux than cPanel, but there are operators for find that will handle this. You can find more details on that here:

Thread starter Similar threads Forum Replies Date
amstel Email 1
T Email 2
M Email 2
A Email 2
K Email 11