recursive file count

Hello. I’v changed ‘scanvirus’ script so it outputs a file counter, better than printing current file scanned. The value matches the scan results output. To create percent and max files output, I need a recursive file count that matches this statement. I’v found several options online.

clamscan -r / --follow-dir-symlinks=0 --follow-file-symlinks=0 --cross-fs=no
find . -type f -type l | wc -l

duckduckgo search: linux recursive find file count

What is the quickest way of doing a recursive file count?

I imagine it depends on what you want.

Are you sure you want a “dumb” file count?

More normally,
Apps iterate a variable each time a loop is executed.

That way, you get an “intelligent” count that corresponds with your activity.


I forgot to exclude some linux directories. The file count should match the file count output of this:

clamscan -r / --exclude-dir=/sys --exclude-dir=/proc --exclude-dir=/dev --exclude-dir=/.snapshots --follow-dir-symlinks=0 --follow-file-symlinks=0 --cross-fs=no

I wasn’t clear, let me explain. The manual file count works on scanvirus. It matches the output of clamscan “scan results”. I need the max file count before the manual file count starts. So, I can create a current/max count and percent.