Script to move into each home and delete all .g* folders
Robert Citek
robert.citek at gmail.com
Tue Nov 10 23:51:22 GMT 2009
On Tue, Nov 10, 2009 at 6:11 PM, Mika Pflüger <mail at mikapflueger.de> wrote:
> 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
Here's another variation using "ls -lad" instead of "rm -rf":
students="foo bar bat"
for i in $students ; do
echo ==$i
cd /home/$i &&
ls -lad .g*
done
Adjust the student= line to your list of students. If the list of
folders looks good, then replace the "ls -lad" with "rm -rf". And I
concur with Mika: make a backup first.
Good luck and let us know how things go.
Regards,
- Robert
More information about the edubuntu-users
mailing list