I have a directory which has many sub-directories. Now, I want to check the space of each dir and redirect the output in a file if space exceeds the limit.
I have already done it, but the way I did is not very good. I just listed the directories and awked the last column to get the directory name. After that, I started a loop with first line of that list and got the space. Is there any good way to check their spaces?
If not clear, please tell me to describe with example.
Thanks in advance!
Deepak
It will sum the space used by each directory under your current working directory. It will only report those directories using more than 1 MB (but you can change this by modifying 1000 to something else). All the output goes to results.txt
Just run the script I gave you. I think it will give you what you want. If not, paste the output twice, and in the second copy, show what you would expect. Please use "[code]" tags around the output.