Function to find files under certain criteria