Because your path is error.
try this
if(direntp->d_type == DT_DIR)
{
if(strcmp(direntp->d_name,".") !=0 && strcmp(direntp->d_name,"..") != 0)
{
sprintf(currentDir, "%s/%s", currDir, direntp->d_name);
foo(currentDir); //Recursive!
}
}