Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Fastest way to count # of files?



On Sep 8,  5:36pm, Sebastian Gniazdowski wrote:
}
} [...]  The second code reads the whole directory too, but
} it's slow. First code doesn't provide way to determine # of files
} read. Is there anything between these two? Something that doesn't
} store files, but counts them?

Try this:

  integer nfiles=0
  : **/*(Ne?'((++nfiles)) && reply=()'?)
  print $nfiles



Messages sorted by: Reverse Date, Date, Thread, Author