#!/bin/bash
#
# du of each subdirectory in a directory for ASM
#
D=$1
if [[ -z $D ]]
then
echo "Please provide a directory !"
exit 1
fi
(for DIR in `asmcmd ls ${D}`
do
echo ${DIR} `asmcmd du ${D}/${DIR} | tail -1`
done) | awk -v D="$D" ' BEGIN { printf("\n\t\t%40s\n\n", D " subdirectories size") ;
printf("%25s%16s%16s\n", "Subdir", "Used MB", "Mirror MB") ;
printf("%25s%16s%16s\n", "------", "-------", "---------") ;}
{
printf("%25s%16s%16s\n", $1, $2, $3) ;
use += $2 ;
mir += $3 ;
}
END { printf("\n\n%25s%16s%16s\n", "------", "-------", "---------");
printf("%25s%16s%16s\n\n", "Total", use, mir) ;} '
$ ./asmdu.sh RECO/CWEOL/ARCHIVELOG
RECO/CWEOL/ARCHIVELOG subdirectories size
Subdir Used MB Mirror MB
------ ------- ---------
2015_07_30/ 25538 25538
2015_07_31/ 69121 69121
2015_08_01/ 56519 56519
2015_08_02/ 25963 25963
2015_08_03/ 45483 45483
2015_08_04/ 64683 64683
2015_08_05/ 68223 68223
2015_08_06/ 78000 78000
2015_08_07/ 86944 86944
2015_08_08/ 85067 85067
2015_08_09/ 84197 84197
2015_08_10/ 77093 77093
2015_08_11/ 83319 83319
2015_08_12/ 86860 86860
2015_08_13/ 83299 83299
2015_08_14/ 80647 80647
2015_08_15/ 77988 77988
2015_08_16/ 83537 83537
2015_08_17/ 81511 81511
2015_08_18/ 85075 85075
2015_08_19/ 83294 83294
2015_08_20/ 75320 75320
2015_08_21/ 67337 67337
2015_08_22/ 68236 68236
2015_08_23/ 70883 70883
2015_08_24/ 72655 72655
2015_08_25/ 75039 75039
2015_08_26/ 66454 66454
2015_08_27/ 62895 62895
2015_08_28/ 70883 70883
2015_08_29/ 86860 86860
2015_08_30/ 31100 31100
2015_08_31/ 56891 56891
2015_09_01/ 66445 66445
2015_09_02/ 85069 85069
2015_09_03/ 86855 86855
2015_09_04/ 85975 85975
2015_09_05/ 90411 90411
2015_09_06/ 93061 93061
2015_09_07/ 96614 96614
2015_09_08/ 54962 54962
------ ------- ---------
Total 2976306 2976306