查找绝对路径以特定模式结束的所有文件

时间:2014-07-25 14:31:48

标签: find filepath glob

使用find和globbing,我怎样才能找到给定目录中的绝对路径(甚至只是相对于给定目录的路径)以/foldername/otherfolder/*.php结尾的所有文件?

1 个答案:

答案 0 :(得分:2)

假设您的意思是整个路径以/foldername/otherfolder/*.php结尾的文件,您只需使用-regex选项

find -regex '.*/foldername/otherfolder/[^/]*.php'

-regex将在相对路径或绝对路径上运行(取决于您提供的内容,默认情况下相对于$PWD)并使用emacs类型。