<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Here's a modification that might make it actually run. Std. "no
guarantees" caveat applies.<br>
<br>
#!/bin/sh<br>
cd /home<br>
for userdir in `ls -C1`<br>
do<br>
echo Working on $userdir...<br>
cd $userdir<br>
for deleteme in `ls -C1 -a`<br>
do<br>
if [[ $deleteme != 'mail' ]] || [[ $deleteme != '.openwebmail' ]]<br>
then do<br>
echo Removing $deleteme...<br>
rm -ri $deleteme<br>
done<br>
else echo "Oops, encountered "$deleteme", not deleting!"<br>
fi<br>
done<br>
done<br>
<div class="moz-signature"><br>
<br>
--TP<br>
_______________________________
<br>
Do you <a href="http://www.gnu.org">GNU</a>?
<br>
<a href="http://www.cmosnetworks.com">Microsoft Free since 2003</a>--the
ultimate antivirus protection!
<br>
</div>
<br>
<br>
Huck wrote:
<blockquote cite="mid471F9E54.2060105@paasda.org" type="cite">for $x in
'ls'
<br>
do
<br>
for $y in 'ls -a'
<br>
if $y != 'mail' || '.openwebmail'
<br>
do rm -rf $y
<br>
<br>
<br>
something like that?
<br>
of course that won't run..but it's the logical thinking behind it
maybe?
<br>
<br>
--Huck
<br>
<br>
Jim Kronebusch wrote:
<br>
<blockquote type="cite">I need to purge files out of an old /home
server that is only running email now. I need
<br>
a script that will run through every user folder on /home and delete
every file/folder
<br>
except a folder named "mail" and a folder named ".openwebmail". I need
those two
<br>
folders and their contents to remain untouched. Can anyone help with
this?
<br>
<br>
Of course I'll assume all caveats regarding testing first and not hold
anyone
<br>
responsible for data loss :-) <br>
Jim
<br>
<br>
</blockquote>
<br>
_______________________________________________
<br>
K12OSN mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:K12OSN@redhat.com">K12OSN@redhat.com</a>
<br>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/k12osn">https://www.redhat.com/mailman/listinfo/k12osn</a>
<br>
For more info see <a class="moz-txt-link-rfc2396E" href="http://www.k12os.org"><http://www.k12os.org></a>
<br>
</blockquote>
</body>
</html>