How to Calculating space used in GB for any particular directory in UNIX?

How to Calculating space used in GB for any particular directory in unix

Currently I am using : df -h which gives me space for each mout point

ldndyn1:/vol/v01/dyn/sbcexp/dyn
                      1.1T  999G   29G  98% /sbcimp/dyn

but I need for some internal particular directory size eg: directory/folder is DIR_A:

Currently I am trying with below command:

du DIR_A  |awk '{sum +=$1} END {print sum}' 

it giving me output as : which I am thinking in bytes?

31758932

Please advise on best approch

try below one:

du -g DIR_A |awk '{sum +=$1} END {print sum}' 

or

du -h DIR_A |awk '{sum +=$1} END {print sum}'

not think that help
*
My is Linux:
_____________________________________

$ du -h  DIR_A/
40M     DIR_A/CDC
1.6M    DIR_A/DQI/dqiadhoc-431
du: cannot read directory `DIR_A/DQI/dqi_lem-8718/lem-8718/.svn': Permission denied
52K     DIR_A/DQI/dqi_lem-8718/lem-8718
56K     DIR_A/DQI/dqi_lem-8718
1.7M    DIR_A/DQI
248M    DIR_A/

__________________________________________________________________________

$ du -h DIR_A '{sum +=$1} END {print sum}'
du: cannot read directory `DIR_A/DQI/dqi_lem-8718/lem-8718/.svn': Permission denied
399.3

It means what it says, it doesn't have permission to access that directory. If that directory's not important, you can ignore that error.

To get a sum of one particular directory, du -hs /path/to/folder 2>/dev/null The -s means 'summary', instead of listing folders inside.