posted 19 years ago
In terms of efficiency, I don't think there's any way to make this operation any faster than O(n).
In terms of implementation, I think it might turn out a bit tedious to keep track of all the last modified dates for all the files -- especially if you have a lot of files.
Instead, try generating a hash for all the files within a directory (recursive operation). This way you only have to keep track of one number, as opposed to possibly thousands of last modified dates. If the hashes don't match that means something has changed.