Using Linux. What I need to do is determine the number of files in a directory(recursively) that are older than DATE and echo that number.
I have: find /u1/database/prod/arch -type f -mtime +10 -exec ls -laR | wc -l \;
That lists the files fine.
And then I have: ls -laR | wc -l
Which lets me count the files recursively.
But I can't seem to put them together. I think I need a script to do this but don't know how to do that.
Would love some help
find /u1/database/prod/arch -type f -mtime +10 | wc -l
works here.
You dont need the exec. use -print (or nothing) and find will print a line per file (and handle the recursion)
find /u1/database/prod/arch -type f -mtime +10 -print | wc -l
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