mirror of
https://github.com/jbranchaud/til
synced 2026-01-04 23:58:01 +00:00
Add Exclude A Directory With Find as a unix til
This commit is contained in:
19
unix/exclude-a-directory-with-find.md
Normal file
19
unix/exclude-a-directory-with-find.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Exclude A Directory With Find
|
||||
|
||||
Using `find` is a handy way to track down files that meet certain criteria.
|
||||
However, if there are directories full of irrelevant files, you may end up
|
||||
with a lot of noise. What you want to do is exclude or ignore such
|
||||
directories. For example, you probably don't want `find` to return results
|
||||
from the `.git` directory of your project.
|
||||
|
||||
Specific directories can be excluded by combining the `-not` and `-path`
|
||||
arguments.
|
||||
|
||||
For instance, to see all files modified within the last 10 days, but not
|
||||
including anything in the `.git` directory, run the following:
|
||||
|
||||
```bash
|
||||
$ find . -type f -not -path './.git/*' -ctime -10
|
||||
```
|
||||
|
||||
[source](http://stackoverflow.com/questions/4210042/exclude-directory-from-find-command)
|
||||
Reference in New Issue
Block a user