We just installed a mass filer device that we want to store data from our suppliers on. They FTP files to it every day and right now, we’ve about 60,000+ files.
Doing find . -name '*TXT' -exec ls '{}' \; | wc -l will work albeit very slowly.
Is there a faster way to count files?
Why not just
? Your current command is unnecessarily spawning
lsfor each file, and that process spawning in itself will be very slow. A quick test on my system would suggest a 40x speed up.