0

I was trying to process a directory of over 10000 files using ksh in Cygwin in Windows 7 and have found that it can take well over a minute before processing can begin because I start by doing an

ls -r | while read....

I can get all the files in a few seconds by doing a

set *
for file; do

but that isn't in the date order. The only way I have found around it right now is by running a MSDOS shell and using "dir" like this:

cmd /c "dir /b /a-d /o-d" | while read...

Is there any simple way of doing this without having to run a dos shell and why does "ls" take so long anyway?

Thanks.

Ban Atman
  • 177
  • 2
  • 3
  • 10
  • 5
    Just to eliminate some possibilities, could you confirm that you still get the same problem when running the `ls` by executing the binary, like so... `/usr/bin/ls -r`? – Costa May 28 '13 at 17:03
  • 1
    Ah ha! Yes, doing a /usr/bin/ls -r had it run fast. I did a `type ls` and it came back with it as an alias for `ls -hF --color=auto`. After a little experimenting it turns out that the `-F` option was causing the lag. Thank you very very much. – Ban Atman May 28 '13 at 17:38

0 Answers0