解决find命令报错: paths must precede expression

Posted yanans

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决find命令报错: paths must precede expression相关的知识,希望对你有一定的参考价值。

今天在使用find命令查找文件时报错:

查找命令:find /var/www/html/typecho/admin/  -name *.php -type f -print | xargs file

报错如下:

find: paths must precede expression: category.php
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
Usage: file [-bchikLlNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
file -C [-m magicfiles]
file [--help]

原因解决:多文件的查找的时候需要增加单引号同时想要星号不被展开就需要加上括号或者反斜杠转义

命令修改为:find /var/www/html/typecho/admin/  -name ‘*.php‘ -type f -print | xargs file  问题解决

 

以上是关于解决find命令报错: paths must precede expression的主要内容,如果未能解决你的问题,请参考以下文章

Eclipse 报错The method xxx of type must override a superclass methodDescription Resource Path Locati

npx 创建nuxt项目 报错 “Path must be a string. Received undefined”in windows

已解决Https请求报错:unable to find valid certification path to requested target

已解决Https请求报错:unable to find valid certification path to requested target

已解决Https请求报错:unable to find valid certification path to requested target

python struct.pack方法报错argument for 's' must be a bytes object 解决