多文件的查找的时候需要增加单引号
find ./ -mtime +30 -type f -name '*.php'
例子说明:
# 进入tmp目录新建4个文本文件
# cd /tmp
# touch {1,2,3,4}.txt
# find . -name *.txt
find: paths must precede expression: 2.txt
出现这个提示是因为星号被展开为当前目录下所有的文件,这样的匹配当然会出错。看这个就知道了:
# echo *
1.txt 2.txt 3.txt 4.txt
# echo '*'
*
# echo \*
*
想要星号不被展开就需要加上括号或者反斜杠转义,知道了这些我们就知道该怎么find了
# find . -name '*.txt'
find . -name '*.txt'
./4.txt
./2.txt
./3.txt
./1.txt
#或者使用反斜杠
find . -name \*.txt
./4.txt
./2.txt
./3.txt
./1.txt