while(1) { if( -d $directory) { # Check for presence of file here } sleep 5; }