简体   繁体   English

在Cygwin中查找文件

[英]Find a file in Cygwin

I use find -name "nametofind" in cygwin to search for a file, but it does not give me any result, even when the file I want to search exists in the current directory. 我在cygwin使用find -name "nametofind"搜索文件,但是即使我要搜索的文件存在于当前目录中,它也不会给我任何结果。 What am I doing wrong? 我究竟做错了什么? Thanks. 谢谢。

As the comment mentioned more succinctly, you need to tell find which directory you want to search. 正如评论中提到的那样,您需要告诉find要搜索哪个目录。 If you it is the current directory, you should use . 如果它是当前目录,则应使用. .

find . -name "nametofind"

It appears that the OP was trying to either match a partial file name or a file name with a different case. 看来OP试图匹配部分文件名或大小写不同的文件名。 As @devnull mentioned in his comment, the correct solution for either case is to use the following. 就像@devnull在他的评论中提到的那样,这两种情况的正确解决方案都是使用以下内容。

find . -iname '*nametofind*'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM