[K12OSN] Script to flush down the drain files from every user home...

Les Mikesell lesmikesell at gmail.com
Sat Jun 21 16:20:31 UTC 2008

James P. Kinney III wrote:
> On Thu, 2008-06-19 at 20:48 -0700, Jim Christiansen wrote:
>> Hi guys,  Thanks the thoughts.  On the upgrade/wipe-install question.
>> Today I backed up the group, shadow, password bla bla bla bla bla
>> files, unplugged the back-up rsync drive and did a full wipe then new
>> k12el5 install.  Put back the vital parts of the necessary conf files,
>> altered the network settings in the template ltsp dir for my different
>> network subnet, did the k12 initialize, plugged in the second drive,
>> mounted it then rsynced back to the users homes and perms of the
>> users...
>> Everything is good to go for the fall start of school!  Now for the
>> other two boxes!
>> OK so. what I need to do is to drop into EVERY users' home and remove
>> a set of files...
>> I've search high and low, through the lists going back 3 years or so
>> and can't find reference to any script that did this.  I think there
>> was one that several contributed to that we used to trash the dot
>> mozilla, .g* files, and I used it also for getting rid of the dot
>> cxoffice folders.  I'm not great at shell scripts.
>> Anyone have one?  Thanks,   Jim  :-)
> for users in `ls -1 /home`
> do
> cd /home/$user
> rm -rf .mozilla .g* .cxoffice*
> done
> Just add more dotfiles to the list. This is a very aggressive script and
> it will not spare any users. Make sure you have a backup of /home first.

I think as-is, that would delete all of the home folders since it sets 
the variable "users" and uses "user" which will be empty.   Also you 
don't want the extra stuff from -l in your ls listing and you probably 
want to make sure the cd succeeded before removing anything.

   Les Mikesell
    lesmikesell at gmail.com

More information about the K12OSN mailing list