search directory implementation