I need some help constructing a directory listing using 'find'?
An example directory structure looks something like this:
/ (root)
- /foo
- /folderA
- /folderB
- /bar
- /folderA
-/search
- /folderB
What I want to find is a list of 'folderA' or 'folderB' directories that do NOT have a 'search' folder. Requested output would be:
/foo/folderA
/foo/folderB
/bar/folderB
I am assuming this can be accomplished with 'find' on a *nix system, but am pretty green with the command. All help is appreciated.
SOLVED: Thank you Khaled for your response leading me in the right direction. Needed a slight modification to include the -E option, but the final solution looked like this:
find -E . -regex '.*(folderA|folderB)' -type d '!' -exec test -d '{}/search' ';' -print
You can find command like: