compare file timestamp in bash

Posted by endroix on Super User See other posts from Super User or by endroix
Published on 2010-05-06T10:53:32Z Indexed on 2010/05/06 10:58 UTC
Read the original article Hit count: 414

Filed under:
|
|
|
|

How do I compare the timestamp of two files?

I tried this but it doesn't work:

file1time=`stat -c %Y fil1.txt`
file2time=`stat -c %Y file2.txt`
if[$file1time -gt $file2time];
then
 doSomething
fi

Thanks

© Super User or respective owner

Related posts about linux

Related posts about bash