Hello,
I’m trying to use linux getdents(or getdents64) system call to list a directory containing files with Go, without success.
Few examples that i have found are based on C language and i’m not familiar with system calls.
Is there any example that i can use or some kind of manual?
I would sincerely appreciate your assistance.
Any reason you’re using getdents
instead of just using os.Readdir
?
@skillian One test (indexer) showed listing ~500k files and folders without utilizing the disk over 10%
In that case, how about (*File).Readdir
? You oen the folder as a file (like for getdents
) and then call Readdir
with smaller n
values (e.g. 1024) to read the entries gradually.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.