Reputation: 13
I have a script that deletes *.log
or *.txt
files either more than 10 MB or more than 15 days old. I wrote the code but cannot put -or
between *log
and *txt
. How can I do that?
find . -iname "*.txt" -type f \( -mtime +15 -or -size +10000k \)
Upvotes: 0
Views: 57
Reputation: 754060
You need to think in terms of:
-iname "*.txt"
or -iname "*.log"
-type f
-mtime +15
or -size +10000k
which translates to:
find . \( -iname "*.txt" -or -iname "*.log" \) -type f \( -mtime +15 -or -size +10000k \)
The default conjunction between terms is 'and' so there's no need for explicit -and
operations.
Upvotes: 1