You need to read
all directory entries and filter out the ones that do not have the
.txt extension. Also, when a returned entry is a directory rather than a normal file, you should call your function recursively to process the sub-directory, and by extension, all sub-directories below that. You should also be using
this function[
^] and its associates.