[K12OSN] scripting trash removal

Mark Gumprecht gumprechtm at msad3.org
Fri Jan 27 18:22:20 UTC 2006


Dave was nice to send me this for clearing cache

!#/bin/bash
for x in `ls /home`; do
echo "Doing $x ..."
cd /home/${x}/.mozilla/firefox/*.default/Cache
rm -Rf *
done

Ok that works just fine. Soooo, If that works for cache, with a little 
mod like this

!#/bin/bash
for x in `ls /home`; do
echo "Doing $x ..."
cd /home/${x}/.Trash
rm -Rf *
done

It should clear out the .Trash directory only... right?
I Ran the script and it deleted out the trash, but it also deleted all 
non hidden files in the root directory from which I ran the script.. 
including itself.
I'm sure it is obvious to someone who knows, but I don't see why it is 
killing all the files.
Any Help Appreciated
Mark

-- 
Mark Gumprecht
Data Systems Specialist
MSAD3
Unity, ME
gumprechtm at msad3.org




More information about the K12OSN mailing list