[K12OSN] Another Script Challenge

Scott Sherrill scott at hancock.k12.mi.us
Wed Jul 14 14:11:48 UTC 2004


>This one may be easier for you....what's the best way to script deleting a
>.recycle folder from every users home directory? (/home/username/.recycle)
>

For a one time delete something like:

#!/usr/bin/perl


$dir="/home/";
while(<$dir/*>)
         {
         ($junk, $uid) = split /\/\//;
         system ("echo /bin/rm -rf $_/.recycle");
         print "$uid.";
         }
print "\n";

just remove the echo from the system call and the above should work. 
Echo is there to test before running ;-)

Scott

-- 
--
Scott Sherrill
Technology Coordinator Hancock Public Schools
Hancock, MI
http://www.hancock.k12.mi.us





More information about the K12OSN mailing list