I want to find files newer than 15 seconds but older than 2 seconds.Here is the script I'm currently using that grabs files newer than 15 seconds:find /my/directory -name '*.jpg' -not -newermt '-15 seconds'Any help is greatly appreciated
Find files newer than 15 seconds but older than 2 seconds
bash;find
You can combine multiple predicates by chaining them.There's no -oldermt, but you can write that as -not -newermt.You want:-newermt '-15 seconds' to say the file is less than 15 seconds old, and -not -newermt '-2 seconds' to say the file is more than 2 seconds oldTry:find /my/directory -newermt '-15 seconds' -not -newermt '-2 seconds'Or, to be POSIX compliant:find /my/directory -newermt '-15 seconds' \! -newermt '-2 seconds'Also, just so you (and other readers) are aware, newer means modified more recently than, not created more recently than.