[K12OSN] OT Help with file deletion script

Jim Kronebusch jim at winonacotter.org
Thu Oct 25 15:16:46 UTC 2007


On Thu, 25 Oct 2007 02:50:27 -0400, Terrell Prudé Jr. wrote
> Here's a modification that might make it actually run.  Std. "no
> guarantees" caveat applies.
> 
> #!/bin/sh
> cd /home
> for userdir in `ls -C1`
> do
>   echo Working on $userdir...
>   cd $userdir
>   for deleteme in `ls -C1 -a`
>   do
>     if [[ $deleteme != 'mail' ]] || [[ $deleteme != '.openwebmail' ]]
>     then do
>       echo Removing $deleteme...
>       rm -ri $deleteme
>     done
>     else echo "Oops, encountered "$deleteme", not deleting!"
>     fi
>   done
> done

I get this error when run:

./homedir_purge: 10: Syntax error: "do" unexpected

Ideas?

Jim

-- 
This message has been scanned for viruses and
dangerous content by the Cotter Technology 
Department, and is believed to be clean.




More information about the K12OSN mailing list