Skip to content

Instantly share code, notes, and snippets.

@taidos
Forked from shanerutter/cpanel_delete_trash.sh
Created January 7, 2022 08:17
Show Gist options
  • Save taidos/92b04651de24a2a03c68d783d4d938c1 to your computer and use it in GitHub Desktop.
Save taidos/92b04651de24a2a03c68d783d4d938c1 to your computer and use it in GitHub Desktop.
#!/bin/sh
for domainhash in `cat /etc/userdomains | grep "\." | sed 's/ //'`
do
read domain user <<<$(echo $domainhash | sed 's/:/ /');
find /home/${user}/mail/${domain}/*/.Trash/{cur,new,tmp}/ -type f | xargs -ifile rm -f file
find /home/${user}/mail/${domain}/*/.Junk/{cur,new,tmp}/ -type f | xargs -ifile rm -f file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment