Directoy Size - avoid cannot read directory

Hello,

I need to write a script to check directory size on a linux server.

I do not have access to some directories Inside the directory tree so I've got some warning in the output that say :

du : cannot read directory ....

Could you please help me. I did try Inside of my script to use :

grep -v "du : cannot read directory "

but that doesn't work.

the output needed have to be :

size : path

Thank for your help

Hi, May i know how do you use that grep, please.
did you use like:

du | grep -v "du : cannot read directory "
du 2>/dev/null

should do the trick