Remove many is_dir, substr calls

Optimize the find_file function and remove many is_dir and substr
calls. Use glob for the recursive selection of files to select folders
directly(without files and „.“ and „..“).