I'm trying to get a count of how many PDFs were created last month. I'm using the following command but it's returning 0
find . -name '*.pdf' -mtime +46 ! -mtime +30 | wc -l
I'm in the correct directory and it seems like the logic is correct... any ideas on why this isn't working? Is there an easier way, say to pass the specific month I'm looking for instead of trying to calculate days like this?
You are finding all pdf
files:
46
days agonot 30
days ago
x>46 && x<=30 --> false
It will return empty result.
Numeric arguments can be specified as
+n for greater than n,
-n for less than n,
n for exactly n.
If you want find all pdf
files (30<x<46
):
$ find . -name '*.pdf' -mtime +30 -mtime -46
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With