Find files older than X and Count them
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
精彩评论