I’d like to,
- Check the word count for a folder full of text files.
- Output a list of the files arranged by word count in the format – FILENAME is WORDCOUNT
I know str_word_count is used to get individual wordcounts for files but I’m not sure how to rearrange the output.
Thanks in advance.
Adapted from here.
EDIT It would be more elegant to have
$file‘s key be the file name and$file‘s value be the word count and then sort by value.