Reading Modified time of a file


I have to write a method which executes a code block only if the file
are modified. I am able to do it by reading modified time of the files
but as the number of files in the directory are more its taking time to
read each file and verifying the modified time of each file. So please


Perhaps instead of reading each file use the stat function? That
should be quick enough unless you're checking hundreds of files.