[K12OSN] shell script to remove contents of several files

Doug Simpson veewee77 at alltel.net
Fri May 19 17:13:09 UTC 2006


Don't actually try this until you get a second opinion, but. . .

find /home/*/mail/ -name * -exec rm -rf {} \;

This should find every mail directory under /home and drop into the mail 
folder there and rm -f the contents.

This will likely clear address books and everything, so use with 
caution. . .

This assumes you are running linux and are using pine conventions for 
mail (We use NeoMail which uses pine conventions).

Any others with other opinions?

A way to test the script to see if it finds the right stuff is to run 
the find and don't add the -exec and on.

Doug

Barry Cisna wrote:

>Hello All,
>
>Due to the fact ,that I am not smart enough, would someone be able to
>give an example of a shell script that would remove the contents of each
>users, email folder,( but of course leave the user's folder on the
>system). I'm wanting to "clean out" everyone's email at the end of the
>school year.
>In other words something like delete contents
>of /var/mail/allusers<folder contents>.
>I'm not sure of correct syntax of "rm" or "shred"
>
>Thanks again,
>
>Barry Cisna
>
>_______________________________________________
>K12OSN mailing list
>K12OSN at redhat.com
>https://www.redhat.com/mailman/listinfo/k12osn
>For more info see <http://www.k12os.org>
>
>  
>




More information about the K12OSN mailing list