There is a chmod function here. From man 3p chmod :
SYNOPSIS #include <sys/stat.h> int chmod(const char *path, mode_t mode); ...
If you want to read permissions, use stat. From man 3p stat :
SYNOPSIS #include <sys/stat.h> int stat(const char *restrict path, struct stat *restrict buf); ...
If you want to do this recursively, as you mentioned, you have to loop through the readdir results yourself.
source share