[K12OSN] script help - please

daniel.hunt at iibbank.ie daniel.hunt at iibbank.ie
Tue May 25 14:00:09 UTC 2004

Is there a reason as to why you'd completely wipe all of the directory off
the system?

Maybe you could just take the largest folder / file and remove that, and
then run the check again ... continue until size < threshold_value?

Or possibly remove write permission on a user's home directory so that they
come to you next time they logon and you can tell them they have 14.3
seconds to delete the warez that they've been downloading before you remove
their home folder entirely? :)


-----Original Message-----
From: Jimmy Schwankl [mailto:schwankl at chatham.k12.nc.us]
Sent: 25 May 2004 14:12
To: k12osn at redhat.com
Subject: [K12OSN] script help - please

Hello good people.  I can't get the syntax right on a script I'm 
working on.  I need to delete a directory's contents when it's size 
gets over a certain amount.  I know this should be uber-easy, but I 
just can't get it.  Here's what I have so far:

# get the size of the directory
du -ks /savedHomedirs/
# if total is over 100MB, then clear out directory
if ($1>100000) then
rm -rf /savedHomedirs/*

#exit 0
exit 0

I'm using tcsh, but I'm willing to run it using a different shell if it 
would make it easier for you to help me:-)  Also, if you have a better 
way to script this, feel free to completely disregard the track I was 
taking and start fresh.

Jimmy Schwankl
There are 10 types of people in this world. Those
who understand binary, and those who don't.

K12OSN mailing list
K12OSN at redhat.com
For more info see <http://www.k12os.org>

This email and any attached files are confidential and may
be legally privileged. It is intended solely for the addressee. 
Access to this email by anyone else is unauthorised. 
If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this 
communication is strictly prohibited. If you have received 
this transmission in error please notify the sender immediately 
by telephone at ++353 1 6035800 or email emailadmin at iibbank.ie 
and then delete this email.
Email transmission cannot be guaranteed to be secure or error free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message, and shall have no liability for any loss or damage
suffered by the user, which arise as a result of email transmission.  
If verification is required please request a hard copy version.

More information about the K12OSN mailing list