"ls" sorts wrongly if given large number of files

Hans-Bernhard Bröker HBBroeker@t-online.de
Wed Jan 6 19:43:37 GMT 2021


Am 06.01.2021 um 19:17 schrieb Kamran via Cygwin:
> Hi all
> 
> "ls" (version 8.26) sorts wrongly if given large number of files via 
> "find" or "xargs"


Actually ls is working just fine here.  You just misunderstand how 
"find" works in this case.

To see what actually happens, you should run

	find -type f -exec echo {} +  | wc -l

in that same directory you did your test case in.   You'll find it does 
_not_ print 1.  Now ponder what that means.

For further information, RTFM at:

	info "finding files" Actions run multi

about how find builds the command lines it sends to the programs to be 
run by "-exec"


More information about the Cygwin mailing list