Finds all files modified more recently than a certain number of seconds ago.
require 'find'
module Find
def match(*paths)
matched = []
find(*paths) { |path| matched << path if yield path }
return matched
end
module_function :match
end
def modified_recently(seconds, *paths)
time = Time.now - seconds
Find.match(*paths) { |p| File.lstat(p).mtime > time }
end
Related examples in the same category