open DF, "/bin/df|" or die "Broken pipe: $!"; while (<DF> ) {print}</pre><HR></BLOCKQUOTE> Of coarse you are not going to just print it. All you have to do at this point is parse the input from df. If you need help with a way to parse it let me know and I will see what I can come up with.

I'm sorry I don't quite understand what you are wanting to do. Do you want to see what Partition is full and then delete stuff from that partition? Do you want to delete specified directory trees? If so based on what? I am easily confused Scott

I am trying to create a script that will run on a cron job. This is on Solaris 2.6, and PerL is installed. What I need is something that can check if the /log (1 gig) directory is more than 90% full. If it is, then it should remove the smallest directory.

The directories are named after the date the logs are created in the format yyyymmdd. An example is 19991201.

What I have now is this line:

ls -p| egrep '/'|head -n 1

This gets me the name of the smallest directory. I also am trying to make PERL script, since I have no idea if there is a function to check for low disk space in Unix.

I also have: df-v which list the utilization, and I can grep the line that I need.

But if you have any other suggestions, or a script that I can use, it would be great!

# I do not know of a way to get the size of an # entire directory in perl without recursing it. # There may be a way I do not know of. The two # ways I know are to either recurse it our self # or use /usr/bin/du. In this example we will # do it our self

# OK now we need to remove the directory recursivly # again I know of no built in way to do this so we # can either recurse is our self or use /bin/rm -r # Here I will use /bin/rm -r sence it is a common program system('/bin/rm','-r',"/log/$sortedkeys[0]") == 0 or die "System /bin/rm -r /log/$sortedkeys[0] failed: $?"; }