Gnuwin32 port of “find”?

。_饼干妹妹 提交于 2019-12-11 06:22:06

问题


Is there a problem with the Gnuwin32 port of "find"? It sort of works on my Windows XP command line, but I get blank stares when I try using file name pattern matching function. It's from "findutils-4.2.20" package. Had to rename to "gfind.exe" so Windows wouldn't confuse with CMD.EXE's "find".
Some samples from my Windows console:

C:\PROGRA~1\GnuWin32\doc\findutils\4.2.20\findutils-4.2.20>gfind .  
.  
./find.chm  
./find.dvi.gz  
./find.GID  
./find.hlp  
./find.html  
./find.pdf  
./find.ps.gz    

That works.
Again, the following works:

C:\PROGRA~1\GnuWin32\doc\findutils\4.2.20\findutils-4.2.20>gfind . -ls  
1970324837321105    0 drw-rw-rw-   2 cjohns89 0               0 Jun  11:34 .  
1688849860610677  128 -rw-rw-rw-   1 cjohns89 0          130729 Mar   2005 ./fin
d.chm  
1688849860610679   76 -rw-rw-rw-   1 cjohns89 0           74301 Mar   2005 ./fin
d.dvi.gz  
21673573207016133   20 -rw-rw-rw-   1 cjohns89 0           16826 Jun  21:05 ./fi
nd.GID  
1688849860610681  152 -rw-rw-rw-   1 cjohns89 0          154036 Mar   2005 ./fin
d.hlp  
1688849860610683  224 -rw-rw-rw-   1 cjohns89 0          226750 Mar   2005 ./fin
d.html  
1688849860610684  372 -rw-rw-rw-   1 cjohns89 0          379300 Mar   2005 ./fin
d.pdf  
1688849860610685  200 -rw-rw-rw-   1 cjohns89 0          201163 Mar   2005 ./fin
d.ps.gz  

But this doesn't do squat.

C:\PROGRA~1\GnuWin32\doc\findutils\4.2.20\findutils-4.2.20>gfind . -iname '*.pdf
' -ls  

It just returns to the prompt. Am I (a novice) just mistaken in my use of syntax or is there a bug?


回答1:


Chuck wrote:

gfind . -iname '*.pdf ' -ls

It's better without the apostrophe, since the Windows XP command line is an MS-DOS one.

For example:

gfind . -iname *.pdf  -ls



回答2:


A little wordy, but this link describes the issue. The short answer is that only double-quotes actually perform quoting in Windows' cmd.exe or command.exe.

Also, bear in mind that Windows expands *.pdf in the local directory first -- see Gnuwin32 find.exe expands wildcard before performing search.



来源:https://stackoverflow.com/questions/2992125/gnuwin32-port-of-find

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!