|
need help in disk space commands
hy i have written a K-shell script that will calculate the number of Disk space used by all the directories under the HOMe dir
#!/bin/ksh
cd /ednpdtu3/u01/pipe
count=`ls -ltr | grep ^d | wc -l`
echo "$count Dir found in HOME DIR"
a1=1
while [ $a1 -le $count ]
do
b=`ls -ltr | grep ^d | head -$a1 | tail -1 | tr -s " " | cut -d " " -f9`
#echo $b
a1=`expr $a1 + 1`
a2=`du -m $b`
echo "The size of $b is $a2"
done
----------------------------------------------------------------------
My home Dir contains 21 Dir. how u get those directories space utilised in MB.
here in my script du -m is not giving proper results
I have a dir called AMIS_Scripts whose total size in MB is 4497.44
but my script is giving results as
The size of AMIS_Scripts is
27.46 AMIS_Scripts/Oncor_exc_miss_rep
4469.52 AMIS_Scripts/temp
4497.44 AMIS_Scripts MB
I dnt want the result of Sub-dir inside AMIS_Scripts to show up, just want the total disk space used in MB by AMIS_SCRIPTS dir to show up in my output
Plz help me in this
Last edited by ali560045; 09-17-2008 at 03:08 AM..
|