On Wed, Oct 18, 2017 at 10:54 PM, Bakul Shah <ba...@bitblocks.com> wrote:
>
> os.Readdirnames() just returns dir enry names[1], while
> os.Readdir() lstats all the dir entries.
>
> Pretty much every OS's (C lang) readdir() returns a direntry's
> type without having to stat the underlying file.  More often
> than not this is all one wants -- not everyone wants to walk a
> directory tree -- and even there filepath.Walk() lstats all
> the files unnecessarily.

(As far as I know Solaris does not yet provide the direntry's type.)


> I have directories with thousands of files and a very smal
> number of subdirs so the lstat overhead is considerable.
>
> Is there a package that does ReadDirents() returning a pair
> ([]string, []byte) or []struct {type byte; name string}?

I'm not aware of one.  It would need to be somewhat system-specific as
different systems lay out the directory entries differently.  It
should be possible to write such a package building on ReadDirent and
ParseDirent in golang.org/x/sys/unix.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to