bash - Need to find files modified between 15 and 5 minutes ago -


i'm trying find files in given folder modified withing time frame, between 5 , 15 minutes ago.

currently can find modified 15 minutes ago using find -cmin

#!/bin/bash  minutes="15"  filetypes=`find . *pattern*.txt* -maxdepth 0 -type f -cmin -$minutes` 

how give time frame?

try :

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

notes

  • the parenthesis not mandatory here and : -a, it's necessary case or: -o
  • always use single quotes around pattern prevent shell expansion of wildcard
  • to give pattern, use -name or -iname
  • for date/hour, -mmin way go minutes , -mtime days.

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -