Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
    
@jw013 You're right, thx –  warl0ck 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? –  warl0ck 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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