in reply to trying to count files in a directory and subs

this is the oldest (previous millemnium) question pronounced in the monastery: see paco's cell..

As many times in the past i suggest the basic and elegant solution by tachyon. It is simple and you can extend it at will. You'll find the original tachyon's post with plain explanation here

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.