I am using 'find' to get the path to a dir called "out" and want it to stop looking after it is found. There can be some 350G worth of files in that dir so I REALLY want it to stop looking once it is found.
This works bu doesn't stop looking, takes too long..
find . -type d -name out
This "ungreedy" approach also works but doesn't seem to stop either...
find . -type d -regex ".+/out/?"
I'm running this in perl, so I suppose I could write a recursive function that reads down a dir tree and does what I want. But is there a brake in "find" that I can apply once the first instance is found?
Thanks in Advance !
Use -quit:
find . -type d -name out -print -quit
Manual for "find" tool is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With