dirs=ยง(find .. -type d -maxdepth 1 ! -name "*.rec" -exec find {} -maxdepth 1 -name "*.rec"} for i in $dirs do echo $i done