[K12OSN] Quick way to empty student folders
pfaffman at gmail.com
Fri Sep 17 02:01:40 UTC 2004
When I write a script like that I always do something like this first:
for i in /home/*; do echo rm -rf $i/*; done
To get an idea what might happen.
It appears that the above won't remove the .dotfiles. That might
really be the desired result, but you might rather
for i in * ; do rm -rf $i; mkdir $i; chown $i.$i $i; done
but you might first
for i in * ; do echo rm -rf $i; echo mkdir $i; echo
chown $i.$i $i; done
Please note that what's left of a hurricane will soon be hitting me,
and this script could be why.
On Thu, 16 Sep 2004 18:05:14 -0700 (PDT), Eric Harrison
<eharrison at mail.mesd.k12.or.us> wrote:
> On Thu, 16 Sep 2004, Chris Hobbs wrote:
> >Jim Christiansen wrote:
> >> Lat year I used some method to empty student folders... What ever it
> >> was I can't think of it.
> >> Has anyone used a quick way to empty the contents of all of the
> >> folders in /home/usernames ?
> >> I need to keep all of the student folders in /home, but everything in
> >> them needs to go...
> >for i in /home/*; do rm -rf /home/$i/*; done
> >NOT TESTED -- POSSIBLY DANGEROUS -- COULD CAUSE GLOBAL WARMING
> >OK, you're on your own if you run it, but it makes sense to me...
> I didn't test this either, but I do see one error. This would be
> (closer to) correct:
> for i in /home/*; do rm -rf $i/*; done
> NOT TESTED -- POSSIBLY DANGEROUS -- COULD CAUSE AN ICE AGE ;-)
> K12OSN mailing list
> K12OSN at redhat.com
> For more info see <http://www.k12os.org>
Jay Pfaffman <pfaffman at utk.edu>
Asst Professor of Instructional Technology, U. TN, Knoxville
Experimenting with gmail, please honor the Reply-To
More information about the K12OSN