View Full Version : ls |wc -l

26th August 2009, 01:51 PM
I've got this directory with a huge number of files of the order ~1.5 million(and continuing to grow).

Theres an app which processes these files and so would decrease the no of files from 1.5 million. if the app doesnt work,the number would increase from the 1.5m. So i need to test whether this app works by making sure that no of files is not growing or size of dir is not increasing.

simple solution is to keep checking number lines using ls my_dir |wc -l .But because of the 1.5m + files ls |wc -l takes a long time (hours) to return any output.

du -h takes a while as well.

Can someone suggest a work around for this?