Having even 1K files in a single directory is a poor design choice. Split them up into chunks.
You can use the readdir() function in C.
https://stackoverflow.com/questions/...ectory-using-c
Can't imagine any faster way. As you can see from the link, there isn't any way to stop reading, once started.
Manpage confirms this:
Code:
READDIR(3) Linux Programmer's Manual READDIR(3)
NAME
readdir, readdir_r - read a directory
SYNOPSIS
#include <dirent.h>
struct dirent *readdir(DIR *dirp);
int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
I only went with C, because you posted to the Development & Programming subforum.
Bookmarks