为什么 GNU find 命令告诉我任何有效路径都是“无效参数”?

为什么 GNU find 命令告诉我任何有效路径都是“无效参数”?

这可能是以下内容的重复发现不工作,但由于我是新会员,我想问一个新问题,而不是评论该问题的答案。如果我要采取其他方式,请原谅我和LMK。

find在 Windows 10 WSL/Debian 系统上运行各种命令时,我看到以下内容:

kenny@pc-name:/mnt/v$ find . -type f ! -iname "*.avi"
find: ‘.’: Invalid argument
kenny@pc-name:/mnt/v$ find /mnt/v -type f ! -iname "*.avi"
find: ‘/mnt/v’: Invalid argument
...5 other attempts to use the same command with other completely-valid paths, with the same result
kenny@pc-name:/mnt/v$ find --version
find (GNU findutils) 4.6.0.225-235f
...other irrelevant lines spat out by --version

正如您所看到的,这个问题与上面链接的问题不同,因为我运行 GNU 查找。我能想到的唯一可能的解释是,这是一个 WSL/Debian 系统,而不是在裸机上运行的纯 Debian。

任何建议将不胜感激,谢谢! :-)

更新:针对@Wildcard的评论,以下是进一步测试的结果:

kenny@pc-name:/mnt/v$ find --help
Usage: find [-H] [-L] [-P] [-Olevel] [-D debugopts] [path...] [expression]

default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:
operators (decreasing precedence; -and is implicit where no others are given):
      ( EXPR )   ! EXPR   -not EXPR   EXPR1 -a EXPR2   EXPR1 -and EXPR2
      EXPR1 -o EXPR2   EXPR1 -or EXPR2   EXPR1 , EXPR2
positional options (always true): -daystart -follow -regextype

normal options (always true, specified before other expressions):
      -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
      --version -xdev -ignore_readdir_race -noignore_readdir_race
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
      -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
      -ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
      -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
      -nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
      -readable -writable -executable
      -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
      -used N -user NAME -xtype [bcdpfls]      -context CONTEXT

actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
      -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
      -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;

Valid arguments for -D:
exec, opt, rates, search, stat, time, tree, all, help
Use '-D help' for a description of the options, or see find(1)

Please see also the documentation at http://www.gnu.org/software/findutils/.
You can report (and track progress on fixing) bugs in the "find"
program via the GNU findutils bug-reporting page at
https://savannah.gnu.org/bugs/?group=findutils or, if
you have no web access, by sending email to <[email protected]>.
kenny@pc-name:/mnt/v$ find /mnt/c/Users/Kenny/Desktop -type f -name *.txt
/mnt/c/Users/Kenny/Desktop/info.txt
/mnt/c/Users/Kenny/Desktop/phone.txt
/mnt/c/Users/Kenny/Desktop/Uber.txt
kenny@pc-name:/mnt/v$ find /mnt/c/Users/Kenny/Desktop -type f -iname *.txt
/mnt/c/Users/Kenny/Desktop/info.txt
/mnt/c/Users/Kenny/Desktop/phone.txt
/mnt/c/Users/Kenny/Desktop/test.TXT
/mnt/c/Users/Kenny/Desktop/Uber.txt
kenny@pc-name:/mnt/v$ find /mnt/c/Users/Kenny/Desktop -type f -not -iname *.txt
/mnt/c/Users/Kenny/Desktop/desktop.ini
/mnt/c/Users/Kenny/Desktop/test.AVI
/mnt/c/Users/Kenny/Desktop/test.MKV
/mnt/c/Users/Kenny/Desktop/test.MP4
/mnt/c/Users/Kenny/Desktop/test.PDF
kenny@pc-name:/mnt/v$ find /mnt/v -type f -not -iname *.txt
find: ‘/mnt/v’: Bad file descriptor
kenny@pc-name:/mnt/v$ find . -type f -not -iname *.txt
find: ‘.’: Bad file descriptor

正如您所看到的,find在我的 C: 驱动器中递归并找到正确的文件没有问题。该问题仅存在于我的 V: 驱动器上,该驱动器是安装有sudo mount -t drvfs '\\192.168.1.1\Videos' /mnt/v.另外,虽然我最初收到“无效参数”错误,但现在在一小时内已更改为“错误文件描述符”,即使当时没有对此 WSL 系统进行其他更改! :S

相关内容