Is there any breadth-first/depth-first option in the Linux `find' utility?
There's nothing built-in to find, even GNU find. You can postprocess the output of
If you can use zsh:
My feeling is that you can. It involves grep and such and a loop, but I find it works very well, specifically for your case about the find not needing to be completed.
It is more resource intensive because of:
This is good because:
#!/bin/bash depth=0 while find -mindepth $depth -maxdepth $depth | grep '.' do depth=$((depth + 1)) done
You can also fit it onto one line fairly(?) easily:
But I prefer small scripts over typing...