linux - 使用 `find` 时如何排除目录?

使用 find 搜索 *.js 文件时如何排除特定目录?

find . -name '*.js'

最佳答案

如果 -prune 对你不起作用,这将:

find -name "*.js" -not -path "./directory/*"

警告:需要遍历所有不需要的目录。

关于linux - 使用 `find` 时如何排除目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4210042/

相关文章:

python - pip 在哪里安装它的包?

python - 子进程中 'shell=True'的实际含义

python - 在 Python 中创建一个空列表

c - 为什么 C 预处理器将单词 "linux"解释为常量 "1"?

python - 网址在 Python 中解码 UTF-8

python - 用一个空格替换非 ASCII 字符

linux - 如何将包含文件的文件夹复制到 Unix/Linux 中的另一个文件夹?

linux - 删除目录的符号链接(symbolic link)

linux - 在 Bash 中循环文件的内容

python - 如何禁用 Pylint 警告?