Linux Find -type f 有限制

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14801313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 18:59:05  来源:igfitidea点击:

Find -type f with restrictions

linuxunixfind

提问by David542

I have the following find command to find all files in a Volume:

我有以下 find 命令来查找卷中的所有文件:

find ./ -type f

How would I exclude all files that start with .? Also, I do want to include foldersthat being with .For example:

我如何排除所有以 开头的文件.?另外,我确实想包括与例如的文件夹.

  • Include .Trashes/file.php
  • Do not include folder/.hidden_file.php
  • 包括 .Trashes/file.php
  • 不包括 folder/.hidden_file.php

What would be the correct findcommand for this?

什么是正确的find命令?

采纳答案by Eric

To exclude all file names which begin with a .

排除所有以 .

find ./ -type f ! -name '.*'

this will search in directories that begin with a . for filenames which do not begin with a .

这将搜索以 . 对于不以 .