Find files that have been modified within the last n minutes

As usual, it took a while to figure this out. It's an easy task using find. But let find also exclude some directories and print something nice, it gets complicated.

Therefore, here's how...
"...to find all files that have been modified under the current directory within the last n minutes excluding a couple of directories and printing the last modification timestamp along with the filename by only using the find command"

find -H . -cmin -$n -and \(wholename './proc/*' -prune -o wholename './sys/*' -prune -o wholename './dev/*' -prune -o printf "%p\t%c\n" \)

And what happens is this:
The whole expression reads like this:
find files with some cmin and (if filename matches ... then skip else if filename matches ... then skip else ... else print)


This page is powered by Blogger. Isn't yours?