code and tests for directory file search