Skip to content

Instantly share code, notes, and snippets.

@yurriy
Created March 26, 2017 11:41
Show Gist options
  • Save yurriy/526a3f6bcc303fe48bb85d45532bcb7e to your computer and use it in GitHub Desktop.
Save yurriy/526a3f6bcc303fe48bb85d45532bcb7e to your computer and use it in GitHub Desktop.
struct dirent *file;
unsigned long long ans = 0;
while ((file = readdir(d))) {
if (!strcmp(file->d_name, ".") || !strcmp(file->d_name, "..")) {
continue;
}
struct stat buf;
full_name[dir_name_len] = '/';
strcpy(full_name + dir_name_len + 1, file->d_name);
if (!stat(full_name, &buf) && check(file->d_name, &buf)) {
ans += buf.st_size;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment