remove basename command and use wc -l for file count