while (1) { if (-e "/my/dir/filename.dat") { do_something_now(); } }