With zsh
and glob qualifiers (e
string):
print -rl -- *(/e_'[[ ! -f $REPLY/README ]]'_)
or
print -rl -- *(/^e_'[[ -f $REPLY/README ]]'_)
add D
to include hidden directories:
print -rl -- *(D/e_'[[ ! -f $REPLY/README ]]'_)
/
selects only directories and e_'[[ ! -f $REPLY/README ]]'_
further selects only the directory names for which the shell code between the quotes returns true
, that is for each directory name ($REPLY
) that the glob *(/)
expands to, it runs [[ ! -f $REPLY/README ]]
and keeps the name of the directory if the result is true
.
The second form ^e_'.....'_
uses the same glob qualifier, negated (but this time the conditional expression isn't negated: [[ -f $REPLY/README ]]
).
The above will only return directory names in the current directory.
If you want to search recursively (again, to include hidden directories add the D
qualifier):
print -rl ./**/*(/e_'[[ ! -f $REPLY/README ]]'_)