Enumerate all share permissions to all shares and share subdirectories on a computer



I am looking to enumerate all share permissions to all shares and share
subdirectories on a computer. Does anybody have a clue on how to do
this? I have listed all shares and I can get permissions for a share
but I have not been able to loop through the subdirectories on a share.
I also would like to find if the sub directory inherits permissions
from the parent directory.

Thanks,
Leo

.