[K12OSN] Another Script Challenge
Michael Wescott
wescott_mike at emc.com
Wed Jul 14 14:32:47 UTC 2004
cwagnon at redbugmail.k12.ar.us asked:
> what's the best way to script deleting a .recycle folder from every
> users home directory? (/home/username/.recycle)
If I was doing it by hand:
cd /home; rm -rf */.recycle
or if the number of users is large:
cd /home; for i in *; do rm -rf $i/.recycle; done
or if they're not all in /home:
awk -F: '$3 >= 500 {print $6}' < /etc/passwd | while read homedir
do
rm -rf $homedir/.recycle
done
where the 500 is lowest uid given to ordinary users.
--
Mike Wescott
Wescott_Mike at EMC.COM
More information about the K12OSN
mailing list