Untitled

 avatar
unknown
plain_text
2 years ago
920 B
10
Indexable
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>



int main()
{
    struct stat sb;
    struct dirent                       *entry  = nullptr;
    char src[250];
    DIR                                 *dir    = opendir("/tmp/");

    if(dir != nullptr)
    {
        while ((entry = readdir(dir)) != nullptr)
        {
            if(entry->d_name[0] == '.')
            {
                continue;
            }

            src[0]='\0';
            strcat(src, "/tmp/");
            strcat(src, entry->d_name);

            if (lstat(src, &sb) == -1) {
                continue;
            }

            if(S_ISDIR(sb.st_mode) == false && sb.st_size > 260)
            {
                printf("Fichero: (%s)  Tamaño: (%jd) bytes \n", src, sb.st_size);
                fflush(stdout);
            }
        }
    }
}
Editor is loading...