find . -type d \! -exec test -e "{}/ContactSheet\*" \; -printUnfortunately, "test" doesn't support globbing, so this always fails.
$ ls Adriana Alessandra Gisele Heidi Jelena Kendall Kim Miranda $ ls * Adriana: Adriana-1.jpg Adriana-3.jpg Adriana-5.jpg Adriana-2.jpg Adriana-4.jpg Adriana-6.jpg Alessandra: Alessandra-1.jpg Alessandra-4.jpg ContactSheet-Alessandra.jpg Alessandra-2.jpg Alessandra-5.jpg Alessandra-3.jpg Alessandra-6.jpg Gisele: Gisele-1.jpg Gisele-3.jpg Gisele-5.jpg Gisele-2.jpg Gisele-4.jpg Gisele-6.jpg Heidi: ContactSheet-Heidi.jpg Heidi-2.jpg Heidi-4.jpg Heidi-6.jpg Heidi-1.jpg Heidi-3.jpg Heidi-5.jpg Jelena: ContactSheet-Jelena.jpg Jelena-2.jpg Jelena-4.jpg Jelena-6.jpg Jelena-1.jpg Jelena-3.jpg Jelena-5.jpg Kendall: Kendall-1.jpg Kendall-3.jpg Kendall-5.jpg Kendall-2.jpg Kendall-4.jpg Kendall-6.jpg Kim: ContactSheet-Kim.jpg Kim-2.jpg Kim-4.jpg Kim-6.jpg Kim-1.jpg Kim-3.jpg Kim-5.jpg Miranda: Miranda-1.jpg Miranda-3.jpg Miranda-5.jpg Miranda-2.jpg Miranda-4.jpg Miranda-6.jpgOK, Josh. I'm feeling you on this one. Maybe I can find some of the lost magic.
$ sort <(find * -type d) <(find * -name ContactSheet-\* | xargs dirname) | uniq -u Adriana Gisele Kendall MirandaThe first "find" gets me all the directory names. The second "find" gets all of the "ContactSheet" files, and then that output gets turned into a list of directory names with "xargs dirname". Then I use the "<(...)" construct to feed both lists of directories into the "sort" command. "uniq -u" gives me a list of the directories that only appear once-- which is the directories that do not have a "ContactSheet" file in them.
$ find * \( -type d -o -name ContactSheet\* \) | sed 's/\/ContactSheet.*//' | uniq -u Adriana Gisele Kendall MirandaBy itself, the "find" command gives me output like this:
$ find * \( -type d -o -name ContactSheet\* \) Adriana Alessandra Alessandra/ContactSheet-Alessandra.jpg Gisele Heidi Heidi/ContactSheet-Heidi.jpg Jelena Jelena/ContactSheet-Jelena.jpg Kendall Kim Kim/ContactSheet-Kim.jpg MirandaThen I use "sed" to pick off the file name, and I end up with the directory list with the duplicate directory names already sorted together. That means I can just feed the results into "uniq -u" and everything is groovy!
c:\> for /D /R %i in (*) do @dir /b %i | find "ContactSheet" > nul || echo %i
c:\tmp\test>for /D /r %i in (*) do @dir /b /s %i | find "ContactSheet" > nul || echo %i c:\tmp\test\ChrisFall c:\tmp\test\dan c:\tmp\test\Fred\Fred2
Click to Open Code Editor