Score:2

How to list all the folders that have a subfolder with a specific name inside them using CLI Bash

pl flag

I would like to use cli to list all the folders in my Documents directory that have a subfolder called "images" is there any way to list them easily?

Thank you

Score:6
hr flag

Using GNU find:

find ~/Documents/ -type d -name images -printf '%h\n'

From the -printf section of man find:

          %h     Leading directories of file's name (all but the last ele‐
                 ment).  If the file name contains no slashes (since it is
                 in the current directory) the  %h  specifier  expands  to
                 `.'.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.