Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
How to get count of files in a directory starting with specific text like dataxxx.csv
There are probably fancier ways, but what works for me is
ls /directory/data* | wc -l
As with all substitutions, the results of a command substitution will undergo WordSplitting, unless the whole thing is inside double quotes.
Using find to test that they are a file (-type f) and match the required pattern ("data*.csv"):
find directory/ -type f -name "data*.csv" | wc -l
find . -maxdepth 1 ...
Required, but never shown