I\'m trying to use GNU find to find only the directories that contain no other directories, but may or may not contain regular files.
My best guess so far has been:
@Sylvian solution didn't work for me on mac os x for some obscure reason. So I've came up with a bit more direct solution. Hope this will help someone:
find . -type d -print0 | xargs -0 -IXXX sh -c '(ls -p XXX | grep / >/dev/null) || echo XXX' ;
Explanation:
ls -p
ends directories with '/'(ls -p XXX | grep / >/dev/null)
returns 0 if there is no directories-print0
&& -0
is to make xargs handle spaces in directory names