[K12OSN] script help - please
Jimmy Schwankl
schwankl at chatham.k12.nc.us
Tue May 25 13:11:42 UTC 2004
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:
#!/bin/tcsh
# 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/*
endif
#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.
Thanks,
Jimmy Schwankl
++++++++++++++++++++++++++++++++++++++
There are 10 types of people in this world. Those
who understand binary, and those who don't.
More information about the K12OSN
mailing list