My friend works in a IT company where he is required to keep a count of XML files inside a directory (including subdirectories).
However the count using ls -LR | grep .xml
or similar takes a lot of time as the count of files is in the millions.
I was thinking what can be a better approach?
Can some kind of background process take care of this, so that whenever there is a new file created or modification time change, it affects the counter (no. of files)?