#!/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