Faster iteration over thousands of files

I'm trying to do something on ~200,000 files in a single folder.

When I do this:

for i in *; do /bin/echo -n "."; done

One dot is printed every few seconds. The same operation on a folder with a hundred files works blazingly fast.

Why is this so? How to accelerate the process for folders with thousands of files?

Answers


Try this with GNU find:

find . -maxdepth 1 -type f -printf "."

Need Your Help

How do ASCII art image conversion algorithms work?

algorithm ascii-art

There are some nice free "image to ASCII art" conversion sites like this one: ASCII-art.org

Stream live video from phone to phone using socket fd

android video-streaming media-player live-streaming file-descriptor

I am new to android programming and have found myself stuck I have been researching various ways to stream live video from phone to phone and seem to have it mostly functional, except of course th...