开发者

Gnuwin32 port of "find"?

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?


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


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.


I think the key to your issue is explained here https://stackoverflow.com/a/3996353/8543838

Does not answer your question, but in the past I too had a few issues with GnuWin32 ‘find’ and I just wanted to let you know there is an alternative, part of ezwinports (another port of gnu tools). I also seem to remember that ezwinports’s find was much faster than GnuWin32’s.

Also, my trick to avoid renaming Gnu tools that are the same as CMD’s built in functions (such as mkdir, echo and find) is to use ‘which find’ for example in a script. Then you know you are using gnu find and don’t need to touch anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜