Hi, Am Tue, 10 Nov 2009 14:29:10 -0700 schrieb Jim Christiansen <[email protected]>: > What I need to do is find a script that will: > > cd into each student home > rm -rf .g* > cd back out > cd into the next student home and repeat all the way through the home > dir Before I make any suggestions, please consider: .g* would match an awful lot of other stuff: Private keys in .gnupg-folders, backups/versioning in .git-folders and similar. Maybe you should rather make a list of what to delete
Make a backup, then try:
1. If you want to delete all those folders in all user's home
directories (not only student's):
rm -rf /home/*/.g*
Just type it into a terminal as root. But it is pretty brutal, as
stated above
2. If you want to delete only the student's folders:
rm -rf /home/{$(cat /etc/group|grep students|cut -d ':' -f4)}/.g*
Replace students with the name of the group of your students. Still
pretty brutal, but works if the group has more than one member.
But, you should use a better wildcard:
rm -rf /home/*/.{gnome,gnome2,gconf}
would be way better already. Note all user's settings will still be
lost, but better than losing their private keys.
So for all the students this would read:
rm -rf /home/{$(cat /etc/group|grep students|cut -d ':'
-f4)}/.{gnome,gnome2,gconf}
of course you can add other offending stuff into the
{gnome,gnome2,gconf} list.
And PLEASE: Before you run this, make a backup and try the command
replacing "rm -rf" with "ls" -- it will show you what will be deleted.
Check the list carefully, as I can't guarantee those one-liners are
really what you need and if I understood you correctly.
Note that with many users you might run into the "command line too
long" error. Then we have to think about something else involving
loops or "find"s
Greetings,
Mika Pflüger
signature.asc
Description: PGP signature
-- edubuntu-users mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/edubuntu-users
