Crazy Idea


how to (politely) stop a find process after the 1st match
April 26, 2007, 12:26 am
Filed under: howto

LazyWeb,

I’m on windows(cygwin); Every now and then, I run a “find” task which finds the file and then continues searching for a lot more time . I’d like it to abort after the 1st match.

eg : find . -type f – iname “foo.txt” -exec xemacs.bat {} ;

Is there a way to tell find that “hey, after you find the 1st match(a file), do the exec piece and then quit the find part of it ?

I know that I could create a .bat file that finds who its parent process is and terminates it. But is there a more nicer way ? 🙂

Thanks for any hints.

Advertisements