find . -type d '!' -exec test -e "{}/yourfile" ';' -print | awk '{if($1==".") system("sbatch ../../../../runthis.sh")}' ^ your file name ^ output will be "." if we have a "." as output do this