Find recently modified files

The Find panel will let you build queries for all files modified after yesterday, or after last hour, etc. However, I’ve been stymied trying to ask for all files which have been modified in the last five minutes. Perhaps there’s an easy way to do it in the GUI, but since I wanted to start myself off in shell scripting, I thought I’d give that a shot. The following script does the trick :

Now=$(date +%s)
Older=$(expr $Now - $@)
echo Files modified in the last $@ seconds :
query -a '(last_modified>='$Older')'

If you paste that into a text file called recent, put it into your /boot/home/config/bin directory, and made sure it’s executable with :

chmod +x /boot/home/config/bin/recent

Then from the terminal you can just type recent 60 to get a quick list of everything modified in the last 60 seconds. Any integer parameter (within reason) should work — recent 300 for five minutes, or even recent 132 if for some reason you want two minutes and 12 seconds. 😉



No comments so far.

(comments are closed)