Class: BackupMonitor::DirectoryHierarchyModificationTime

Inherits:
Object
  • Object
show all
Defined in:
lib/backup_monitor/directory_hierarchy_modification_time.rb

Class Method Summary collapse

Class Method Details

.modification_time(root_path) ⇒ Object

TODO: This is slow and kludgy



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/backup_monitor/directory_hierarchy_modification_time.rb', line 4

def self.modification_time(root_path)
  newest_mtime = nil
  newest_path = nil
  Dir["#{root_path}/**"].each do |f|
    next if File.directory? f
    mtime = File.mtime f
    if newest_mtime.nil? or mtime > newest_mtime
      newest_mtime = mtime
      newest_path = f
    end
  end
  newest_mtime
end