2

How can I search for files that were modified or changed 5 minutes before and 5 minutes after, a certain file. I have tried

mint@mint ~/Desktop $ touch -t 201210101315 /tmp/timestamp
mint@mint ~/Desktop $ sudo find . ~ -cmin -5 | xargs ls -l

to create a temp file with that time stamp and search for files changed within 5 minutes but I'm only getting files changed 5 minutes within current time. What is the simplest way?

1

Use the -a (and) condition, e.g

find . -cmin -5 -cnewer /tmp/timestamp

Will find all files changed in 5 minutes and newer than /tmp/timestamp

  • @jw013 You're right, thx – daisy Oct 10 '12 at 14:19
  • @warl0ck The -a (and) condition is not necessary. expr1 -a expr2 is same as expr1 expr2 – Jhonathan Oct 10 '12 at 14:25
  • @Jhonathan wait, why does it exists? – daisy Oct 10 '12 at 14:31
  • @warl0ck Manual for command "man" does not indicate it, only said to be equal. I think the option -a is to understand easily that the found files meet two conditions. – Jhonathan Oct 10 '12 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.