I fixed it:
n = scandir(path, &namelist, filter, alphasort);
if (l_option) { // flag if -l is given
while (i < n) {
char* temp = (char *) malloc(sizeof(path)+sizeof(namelist[i]->d_name));
strcpy(temp, path); //copy path to temp
stat(strcat(temp, namelist[i]->d_name), &s); // we pass path to + name of file
total += s.st_blocks;
free(temp);
free(namelist[i++]); // optimization rules!
}
free(namelist);
printf("total %d\n", total/2);
}
So basicly, I make new char array containing the dir_name + the name of file, then I get stat structure and use it to find the total.