Use find command but exclude files in two directories

前端 未结 6 1081
刺人心
刺人心 2021-01-29 22:16

I want to find files that end with _peaks.bed, but exclude files in the tmp and scripts folders.

My command is like this:

6条回答
  •  滥情空心
    2021-01-29 23:07

    Try something like

    find . \( -type f -name \*_peaks.bed -print \) -or \( -type d -and \( -name tmp -or -name scripts \) -and -prune \)
    

    and don't be too surprised if I got it a bit wrong. If the goal is an exec (instead of print), just substitute it in place.

提交回复
热议问题