bashscriptingfind

Need to find files modified between 15 and 5 minutes ago


I'm trying to find all files in a given folder that were modified withing a certain time frame, say between 5 and 15 minutes ago.

Currently I can find anything modified say up to 15 minutes ago by using find -cmin

#!/bin/bash

minutes="15"

FILETYPES=`find . *PATTERN*.txt* -maxdepth 0 -type f -cmin -$minutes`

How do I give it a time frame?


Solution

  • Try this :

    find . -name '*pattern.txt' -maxdepth 1 -type f \( -mmin -15 -a -mmin +5 \)
    

    Notes