查找比匹配目录更深一层的目录列表
我正在尝试获取特定文件夹中包含的目录的列表。 给定这些示例文件夹: foo/bar/test foo/bar/test/css foo/bar/wp-content/plugins/XYZ foo/bar/wp-content/plugins/XYZ/js foo/bar/wp-content/plugins/XYZ/css baz/wp-content/plugins/ABC baz/wp-content/plugins/ABC/inc baz/wp-content/plugins/ABC/inc/lib baz/wp-content/plugins/DEF bat/bar/foo/blog/wp-content/plugins/GHI 我想要一个将返回的命令: XYZ ABC DEF GHI 本质上,我正在寻找wp-content / plugins /中的文件夹 使用find使我最接近,但是我不能使用-maxdepth,因为该文件夹与我要搜索的位置存在一定距离。 运行以下命令以递归方式返回所有子目录。 find -type d -path *wp-content/plugins/* foo/bar/wp-content/plugins/XYZ foo/bar/wp-content/plugins/XYZ/js foo/bar/wp-content/plugins/XYZ/css baz/wp-content/plugins/ABC baz/wp-content/plugins/ABC/inc baz/wp-content/plugins/ABC/inc/lib baz/wp-content/plugins/DEF bat/bar/foo/blog/wp-content/plugins/GHI