如何使用 CLI Bash 列出其中包含具有特定名称的子文件夹的所有文件夹

Geo*_* G. 2 command-line bash

我想使用 cli 列出我的文档目录中具有名为“images”子文件夹的所有文件夹,有什么方法可以轻松列出它们?

谢谢

ste*_*ver 6

使用 GNU find

\n
find ~/Documents/ -type d -name images -printf '%h\\n'\n
Run Code Online (Sandbox Code Playgroud)\n

来自-printf以下部分man find

\n
          %h     Leading directories of file's name (all but the last ele\xe2\x80\x90\n                 ment).  If the file name contains no slashes (since it is\n                 in the current directory) the  %h  specifier  expands  to\n                 `.'.\n
Run Code Online (Sandbox Code Playgroud)\n