I made a file list of /usr/local/texlive/2013/texmf-dist/tex/latex/base, the first lines of which look like
/usr/local/texlive/2013/texmf-dist/tex/latex/base/alltt.sty
/usr/local/texlive/2013/texmf-dist/tex/latex/base/ansinew.def
/usr/local/texlive/2013/texmf-dist/tex/latex/base/applemac.def
/usr/local/texlive/2013/texmf-dist/tex/latex/base/article.cls
/usr/local/texlive/2013/texmf-dist/tex/latex/base/article.sty
/usr/local/texlive/2013/texmf-dist/tex/latex/base/ascii.def
/usr/local/texlive/2013/texmf-dist/tex/latex/base/bezier.sty
I saved the list in the file filelist.txt. Then I prepared this document:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\MakeFileList}{mm}
{%1 = list name, #2 = file name
\grill_make_file_list:nn { #1 } { #2 }
}
\NewDocumentCommand{\CountItemsInList}{ O{} m }
{
\grill_count_items_in_list:nn { #1 } { #2 }
}
\ior_new:N \l_grill_file_list_stream
\seq_new:N \l__grill_file_list_temp_seq
\cs_new_protected:Npn \grill_make_file_list:nn #1 #2
{
\seq_new:c { g_grill_file_list_#1_seq }
\ior_open:Nn \l_grill_file_list_stream { #2 }
\ior_map_inline:Nn \l_grill_file_list_stream
{
\seq_gput_right:cn { g_grill_file_list_#1_seq } { ##1 }
}
}
\cs_new_protected:Npn \grill_count_items_in_list:nn #1 #2
{
\seq_clear:N \l__grill_file_list_temp_seq
\seq_map_inline:cn { g_grill_file_list_#2_seq }
{
\tl_if_in:nnT { ##1 } { #1 }
{
\seq_put_right:Nn \l__grill_file_list_temp_seq { ##1 }
}
}
\seq_count:N \l__grill_file_list_temp_seq
}
\ExplSyntaxOff
\begin{document}
\MakeFileList{LaTeX}{filelist.txt}
There are \CountItemsInList{LaTeX} files in total.
There are \CountItemsInList[.tex]{LaTeX} \texttt{.tex} files.
There are \CountItemsInList[.def]{LaTeX} \texttt{.def} files.
There are \CountItemsInList[.ltx]{LaTeX} \texttt{.ltx} files.
There are \CountItemsInList[.sty]{LaTeX} \texttt{.sty} files.
\end{document}
There are of course other methods for building the list. A finer control over the file types could be obtained with regular expressions. The same method used for counting the items could be used for building new lists based on the file extension or for creating links.
Here's the result.

Just to prove the correctness of the result, here's a set of shell commands:
> ls /usr/local/texlive/2013/texmf-dist/tex/latex/base/ | wc -l
149
> ls /usr/local/texlive/2013/texmf-dist/tex/latex/base/*.tex | wc -l
12
> ls /usr/local/texlive/2013/texmf-dist/tex/latex/base/*.def | wc -l
32
> ls /usr/local/texlive/2013/texmf-dist/tex/latex/base/*.ltx | wc -l
6
> ls /usr/local/texlive/2013/texmf-dist/tex/latex/base/*.sty | wc -l
30